It is late and it at least seems to work better than before...
This commit is contained in:
parent
375c695ba1
commit
aad36568ea
|
@ -1326,9 +1326,9 @@ bool WindowsRunCommand(const char* command, const char* dir,
|
|||
std::string& output, int& retVal, bool verbose)
|
||||
{
|
||||
//verbose = true;
|
||||
std::cerr << std::endl
|
||||
<< "WindowsRunCommand(" << command << ")" << std::endl
|
||||
<< std::flush;
|
||||
//std::cerr << std::endl
|
||||
// << "WindowsRunCommand(" << command << ")" << std::endl
|
||||
// << std::flush;
|
||||
const int BUFFER_SIZE = 4096;
|
||||
char buf[BUFFER_SIZE];
|
||||
|
||||
|
@ -1433,8 +1433,8 @@ bool WindowsRunCommand(const char* command, const char* dir,
|
|||
//std::cout << "Read data..." << std::endl;
|
||||
ReadFile(read_stdout,buf,1023,&bread,NULL);
|
||||
|
||||
//read the stdout pipe
|
||||
printf("%s",buf);
|
||||
//read the stdout pipe
|
||||
std::cout << buf << std::flush;
|
||||
memset(buf, 0, sizeof(buf));
|
||||
|
||||
}
|
||||
|
@ -1447,8 +1447,7 @@ bool WindowsRunCommand(const char* command, const char* dir,
|
|||
output += "\n";
|
||||
if(verbose)
|
||||
{
|
||||
std::cerr << verbose << " [{" << buf << "}]"
|
||||
<< std::endl << std::flush;
|
||||
std::cout << buf << std::flush;
|
||||
|
||||
}
|
||||
|
||||
|
@ -1479,6 +1478,9 @@ bool RunCommandViaWin32(const char* command,
|
|||
int& retVal,
|
||||
bool verbose)
|
||||
{
|
||||
#if defined(__BORLANDC__)
|
||||
return ::WindowsRunCommand(command, dir, output, retVal, verbose);
|
||||
#else // Visual studio
|
||||
::SetLastError(ERROR_SUCCESS);
|
||||
if ( ! command )
|
||||
{
|
||||
|
@ -1505,6 +1507,7 @@ bool RunCommandViaWin32(const char* command,
|
|||
output = resProc.GetOutput();
|
||||
retVal = resProc.GetExitValue();
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
// use this for shell commands like echo and dir
|
||||
|
|
Loading…
Reference in New Issue