runnerw: use GetLastError as exit code if CreateProcessW fails (IDEA-CR-25052)

GetLastError returns error=2 if child process executable file not found (ERROR_FILE_NOT_FOUND from https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382)
This commit is contained in:
Sergey Simonchik
2017-10-05 11:28:24 +03:00
parent d9313f31b3
commit fb39a9f557
2 changed files with 4 additions and 2 deletions
Binary file not shown.
+4 -2
View File
@@ -294,10 +294,12 @@ int main(int argc, char * argv[]) {
NULL,
&si,
&pi)) {
DWORD exitCode = GetLastError();
if (exitCode == 0) exitCode = 1;
ErrorMessage("CreateProcess");
CloseHandle(newstdin);
CloseHandle(write_stdin);
exit(2);
exit(exitCode);
}
if (hasConsoleWindow || childParams.createNewConsole) {
attachChildConsole(pi);
@@ -308,7 +310,7 @@ int main(int argc, char * argv[]) {
CreateThread(NULL, 0, &scanStdinThread, &write_stdin, 0, NULL);
unsigned long exitCode = 0;
DWORD exitCode = 0;
while (true) {
int rc = WaitForSingleObject(pi.hProcess, INFINITE);