diff options
author | Craig Scott <craig.scott@crascit.com> | 2018-03-04 06:27:09 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2018-03-08 09:07:14 (GMT) |
commit | e60e4dfc88252aaec53f0d832508d41dff6165fd (patch) | |
tree | 5903e9e8f2eb57780d47a21d83f282f9cee11741 /Source/cmGlobalGenerator.cxx | |
parent | e654622aee22655c418a9c663fad79243ca0c819 (diff) | |
download | CMake-e60e4dfc88252aaec53f0d832508d41dff6165fd.zip CMake-e60e4dfc88252aaec53f0d832508d41dff6165fd.tar.gz CMake-e60e4dfc88252aaec53f0d832508d41dff6165fd.tar.bz2 |
cmWorkingDirectory: Check success of current dir changes
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index c805b98..f9eb90f 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -6,11 +6,11 @@ #include "cmsys/FStream.hxx" #include <algorithm> #include <assert.h> +#include <cstring> #include <iterator> #include <sstream> #include <stdio.h> #include <stdlib.h> -#include <string.h> #if defined(_WIN32) && !defined(__CYGWIN__) #include <windows.h> @@ -1806,6 +1806,8 @@ int cmGlobalGenerator::Build(const std::string& /*unused*/, cmSystemTools::OutputOption outputflag, std::vector<std::string> const& nativeOptions) { + bool hideconsole = cmSystemTools::GetRunCommandHideConsole(); + /** * Run an executable command and put the stdout in output. */ @@ -1813,9 +1815,17 @@ int cmGlobalGenerator::Build(const std::string& /*unused*/, output += "Change Dir: "; output += bindir; output += "\n"; + if (workdir.Failed()) { + cmSystemTools::SetRunCommandHideConsole(hideconsole); + cmSystemTools::Error("Failed to change directory: ", + std::strerror(workdir.GetLastResult())); + output += "Failed to change directory: "; + output += std::strerror(workdir.GetLastResult()); + output += "\n"; + return 1; + } int retVal; - bool hideconsole = cmSystemTools::GetRunCommandHideConsole(); cmSystemTools::SetRunCommandHideConsole(true); std::string outputBuffer; std::string* outputPtr = &outputBuffer; |