It is late and it at least seems to work better than before...

This commit is contained in:
Andy Cedilnik 2002-09-29 21:57:48 -04:00
parent 375c695ba1
commit aad36568ea
1 changed files with 44 additions and 41 deletions

View File

@ -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];
@ -1434,7 +1434,7 @@ bool WindowsRunCommand(const char* command, const char* dir,
ReadFile(read_stdout,buf,1023,&bread,NULL);
//read the stdout pipe
printf("%s",buf);
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