diff -r -u -p src/cygstart/cygstart.c newsrc/cygstart/cygstart.c --- src/cygstart/cygstart.c 2008-09-04 22:49:41.000000000 +0100 +++ newsrc/cygstart/cygstart.c 2008-09-04 23:04:52.000000000 +0100 @@ -410,7 +410,7 @@ if (file) free(file); - return (ret ? 0 : 1); + return ret; } /* Start a program, or open a file or URL, using Cygwin POSIX paths */ @@ -454,10 +454,10 @@ int ret = (int) ShellExecute(NULL, action, aPath, args, workDir, show); if (ret >= 32) { - return TRUE; + return 0; } else { fprintf(stderr, "Unable to start '%s': %s\n", aPath, startError(ret)); - return FALSE; + return 1; } } else { SHELLEXECUTEINFO sei; @@ -474,21 +474,26 @@ if (!ShellExecuteEx(&sei)) { if (((int) sei.hInstApp) < 32) { fprintf(stderr, "Unable to start '%s': %s\n", aPath, startError((int) sei.hInstApp)); - return FALSE; + return 1; } else { fprintf(stderr, "Unable to start '%s': ", aPath); printLastError(stderr); fprintf(stderr, "\n"); - return FALSE; + return 1; } } if (sei.hProcess) { + DWORD code; WaitForSingleObject(sei.hProcess, INFINITE); + if (!GetExitCodeProcess(sei.hProcess, &code)) { + code = 1; + } CloseHandle(sei.hProcess); + return (int) code; } - return TRUE; + return 0; } }