ENH: add better error output

This commit is contained in:
Bill Hoffman 2001-07-05 17:52:31 -04:00
parent 863ca7d0e2
commit 05fb9379ef
1 changed files with 9 additions and 3 deletions

View File

@ -780,9 +780,14 @@ bool cmSystemTools::RunCommand(const char* command,
std::ifstream fin(tempFile.c_str()); std::ifstream fin(tempFile.c_str());
if(!fin) if(!fin)
{ {
cmSystemTools::Error(command, std::string errormsg = "RunCommand produced no output: command: \"";
" from RunCommand Failed to create output file: ", errormsg += command;
tempFile.c_str()); errormsg += "\"";
errormsg += "\nOutput file: ";
errormsg += tempFile;
cmSystemTools::Error(errormsg.c_str());
fin.close();
cmSystemTools::RemoveFile(tempFile.c_str());
return false; return false;
} }
while(fin) while(fin)
@ -790,6 +795,7 @@ bool cmSystemTools::RunCommand(const char* command,
fin.getline(buffer, BUFFER_SIZE); fin.getline(buffer, BUFFER_SIZE);
output += buffer; output += buffer;
} }
fin.close();
cmSystemTools::RemoveFile(tempFile.c_str()); cmSystemTools::RemoveFile(tempFile.c_str());
return true; return true;
#else #else