diff options
author | Jan Niklas Hasse <jhasse@bixense.com> | 2020-03-26 21:55:26 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-26 21:55:26 (GMT) |
commit | 8900fa55b56ba1e2f83b3f3ba2a1b336c97e5dc3 (patch) | |
tree | 9e968f235281692bfee1a56a74a4e05ea8916273 /src | |
parent | b50e1e3bc636abd75cb7aa444aeb397cc324e325 (diff) | |
parent | 3242c794fa408737d9d24290b543b4e5db5dbdde (diff) | |
download | Ninja-8900fa55b56ba1e2f83b3f3ba2a1b336c97e5dc3.zip Ninja-8900fa55b56ba1e2f83b3f3ba2a1b336c97e5dc3.tar.gz Ninja-8900fa55b56ba1e2f83b3f3ba2a1b336c97e5dc3.tar.bz2 |
Merge pull request #1637 from beevik/windows-create-process-fix
Improve error messages when ninja commands fail on Windows.
Diffstat (limited to 'src')
-rw-r--r-- | src/subprocess-win32.cc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/subprocess-win32.cc b/src/subprocess-win32.cc index a4a7669..d221476 100644 --- a/src/subprocess-win32.cc +++ b/src/subprocess-win32.cc @@ -124,12 +124,20 @@ bool Subprocess::Start(SubprocessSet* set, const string& command) { buf_ = "CreateProcess failed: The system cannot find the file " "specified.\n"; return true; - } else if (error == ERROR_INVALID_PARAMETER) { - // This generally means that the command line was too long. Give extra - // context for this case. - Win32Fatal("CreateProcess", "is the command line too long?"); } else { - Win32Fatal("CreateProcess"); // pass all other errors to Win32Fatal + fprintf(stderr, "\nCreateProcess failed. Command attempted:\n\"%s\"\n", + command.c_str()); + const char* hint = NULL; + // ERROR_INVALID_PARAMETER means the command line was formatted + // incorrectly. This can be caused by a command line being too long or + // leading whitespace in the command. Give extra context for this case. + if (error == ERROR_INVALID_PARAMETER) { + if (command.length() > 0 && (command[0] == ' ' || command[0] == '\t')) + hint = "command contains leading whitespace"; + else + hint = "is the command line too long?"; + } + Win32Fatal("CreateProcess", hint); } } |