summaryrefslogtreecommitdiffstats
path: root/Source/cmcmd.cxx
diff options
context:
space:
mode:
authorJames Johnston <johnstonj.public@codenest.com>2015-08-08 05:06:27 (GMT)
committerJames Johnston <johnstonj.public@codenest.com>2015-08-08 05:06:27 (GMT)
commit203b20df98512094cc74061fd1b76e87bd2d3afb (patch)
treee639fc6b20dab7c7789ffe4b0954544159af4e42 /Source/cmcmd.cxx
parentb28b07db47b181718643399bd2aedc3e6d1b29c4 (diff)
downloadCMake-203b20df98512094cc74061fd1b76e87bd2d3afb.zip
CMake-203b20df98512094cc74061fd1b76e87bd2d3afb.tar.gz
CMake-203b20df98512094cc74061fd1b76e87bd2d3afb.tar.bz2
cmcmd: Improve error handling when executing a process.
Diffstat (limited to 'Source/cmcmd.cxx')
-rw-r--r--Source/cmcmd.cxx19
1 files changed, 14 insertions, 5 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 71f47f3..7bee0ea 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -1468,18 +1468,24 @@ bool cmcmd::RunCommand(const char* comment,
std::string output;
int retCode =0;
// use rc command to create .res file
- cmSystemTools::RunSingleCommand(command,
- &output, &output,
- &retCode, 0, cmSystemTools::OUTPUT_NONE);
+ bool res = cmSystemTools::RunSingleCommand(command,
+ &output, &output,
+ &retCode, 0,
+ cmSystemTools::OUTPUT_NONE);
// always print the output of the command, unless
// it is the dumb rc command banner, but if the command
// returned an error code then print the output anyway as
// the banner may be mixed with some other important information.
if(output.find("Resource Compiler Version") == output.npos
- || retCode !=0)
+ || !res || retCode)
{
std::cout << output;
}
+ if (!res)
+ {
+ std::cout << comment << " failed to run." << std::endl;
+ return false;
+ }
// if retCodeOut is requested then always return true
// and set the retCodeOut to retCode
if(retCodeOut)
@@ -1593,7 +1599,10 @@ int cmcmd::VisualStudioLinkIncremental(std::vector<std::string>& args,
mtCommand.push_back(tempManifest);
// now run mt.exe to create the final manifest file
int mtRet =0;
- cmcmd::RunCommand("MT", mtCommand, verbose, &mtRet);
+ if(!cmcmd::RunCommand("MT", mtCommand, verbose, &mtRet))
+ {
+ return -1;
+ }
// if mt returns 0, then the manifest was not changed and
// we do not need to do another link step
if(mtRet == 0)