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)
|
std::string& output, int& retVal, bool verbose)
|
||||||
{
|
{
|
||||||
//verbose = true;
|
//verbose = true;
|
||||||
std::cerr << std::endl
|
//std::cerr << std::endl
|
||||||
<< "WindowsRunCommand(" << command << ")" << std::endl
|
// << "WindowsRunCommand(" << command << ")" << std::endl
|
||||||
<< std::flush;
|
// << std::flush;
|
||||||
const int BUFFER_SIZE = 4096;
|
const int BUFFER_SIZE = 4096;
|
||||||
char buf[BUFFER_SIZE];
|
char buf[BUFFER_SIZE];
|
||||||
|
|
||||||
@ -1434,7 +1434,7 @@ bool WindowsRunCommand(const char* command, const char* dir,
|
|||||||
ReadFile(read_stdout,buf,1023,&bread,NULL);
|
ReadFile(read_stdout,buf,1023,&bread,NULL);
|
||||||
|
|
||||||
//read the stdout pipe
|
//read the stdout pipe
|
||||||
printf("%s",buf);
|
std::cout << buf << std::flush;
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1447,8 +1447,7 @@ bool WindowsRunCommand(const char* command, const char* dir,
|
|||||||
output += "\n";
|
output += "\n";
|
||||||
if(verbose)
|
if(verbose)
|
||||||
{
|
{
|
||||||
std::cerr << verbose << " [{" << buf << "}]"
|
std::cout << buf << std::flush;
|
||||||
<< std::endl << std::flush;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1479,6 +1478,9 @@ bool RunCommandViaWin32(const char* command,
|
|||||||
int& retVal,
|
int& retVal,
|
||||||
bool verbose)
|
bool verbose)
|
||||||
{
|
{
|
||||||
|
#if defined(__BORLANDC__)
|
||||||
|
return ::WindowsRunCommand(command, dir, output, retVal, verbose);
|
||||||
|
#else // Visual studio
|
||||||
::SetLastError(ERROR_SUCCESS);
|
::SetLastError(ERROR_SUCCESS);
|
||||||
if ( ! command )
|
if ( ! command )
|
||||||
{
|
{
|
||||||
@ -1505,6 +1507,7 @@ bool RunCommandViaWin32(const char* command,
|
|||||||
output = resProc.GetOutput();
|
output = resProc.GetOutput();
|
||||||
retVal = resProc.GetExitValue();
|
retVal = resProc.GetExitValue();
|
||||||
return true;
|
return true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// use this for shell commands like echo and dir
|
// use this for shell commands like echo and dir
|
||||||
|
Loading…
x
Reference in New Issue
Block a user