diff options
author | Qingning Huo <qingninghuo@gmail.com> | 2012-01-20 21:01:54 (GMT) |
---|---|---|
committer | Qingning Huo <qingninghuo@gmail.com> | 2012-01-20 21:01:54 (GMT) |
commit | 665a30bc2dc78940ff3e1ec90d2f5bb7d329a71c (patch) | |
tree | 3fcfd17be45e74fe2a67dbb71ef969d47d09e7de /src | |
parent | 2ef3a546476987d6565141337c6309e7ae60f9fd (diff) | |
download | Ninja-665a30bc2dc78940ff3e1ec90d2f5bb7d329a71c.zip Ninja-665a30bc2dc78940ff3e1ec90d2f5bb7d329a71c.tar.gz Ninja-665a30bc2dc78940ff3e1ec90d2f5bb7d329a71c.tar.bz2 |
Mark CreateProcess "program not found" failure as non-fatal
Diffstat (limited to 'src')
-rw-r--r-- | src/subprocess-win32.cc | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/subprocess-win32.cc b/src/subprocess-win32.cc index cf61feb..e757f7e 100644 --- a/src/subprocess-win32.cc +++ b/src/subprocess-win32.cc @@ -95,7 +95,18 @@ bool Subprocess::Start(SubprocessSet* set, const string& command) { /* inherit handles */ TRUE, 0, NULL, NULL, &startup_info, &process_info)) { - Win32Fatal("CreateProcess"); + DWORD error = GetLastError(); + if (error == ERROR_FILE_NOT_FOUND) { // file (program) not found error is treated as a normal build action failure + if (child_pipe) + CloseHandle(child_pipe); + CloseHandle(pipe_); + pipe_ = NULL; + // child_ is already NULL; + buf_ = "CreateProcess failed: The system cannot find the file specified.\n"; + return true; + } else { + Win32Fatal("CreateProcess"); // pass all other errors to Win32Fatal + } } // Close pipe channel only used by the child. @@ -139,6 +150,10 @@ void Subprocess::OnPipeReady() { } bool Subprocess::Finish() { + if (! child_) { + return false; + } + // TODO: add error handling for all of these. WaitForSingleObject(child_, INFINITE); @@ -170,7 +185,10 @@ SubprocessSet::~SubprocessSet() { } void SubprocessSet::Add(Subprocess* subprocess) { - running_.push_back(subprocess); + if (subprocess->child_) + running_.push_back(subprocess); + else + finished_.push(subprocess); } void SubprocessSet::DoWork() { |