diff options
Diffstat (limited to 'PC/launcher.c')
-rw-r--r-- | PC/launcher.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/PC/launcher.c b/PC/launcher.c index dfad44a3593..358b99fb5ed 100644 --- a/PC/launcher.c +++ b/PC/launcher.c @@ -535,7 +535,7 @@ run_child(wchar_t * cmdline) error(RC_CREATE_PROCESS, L"Unable to create process using '%s'", cmdline); AssignProcessToJobObject(job, pi.hProcess); CloseHandle(pi.hThread); - WaitForSingleObject(pi.hProcess, INFINITE); + WaitForSingleObjectEx(pi.hProcess, INFINITE, FALSE); ok = GetExitCodeProcess(pi.hProcess, &rc); if (!ok) error(RC_CREATE_PROCESS, L"Failed to get exit code of process"); @@ -1208,6 +1208,7 @@ process(int argc, wchar_t ** argv) void * version_data; VS_FIXEDFILEINFO * file_info; UINT block_size; + int index; wp = get_env(L"PYLAUNCH_DEBUG"); if ((wp != NULL) && (*wp != L'\0')) @@ -1256,8 +1257,8 @@ process(int argc, wchar_t ** argv) if (!valid) debug(L"GetFileVersionInfo failed: %X\n", GetLastError()); else { - valid = VerQueryValueW(version_data, L"\\", &file_info, - &block_size); + valid = VerQueryValueW(version_data, L"\\", + (LPVOID *) &file_info, &block_size); if (!valid) debug(L"VerQueryValue failed: %X\n", GetLastError()); else { @@ -1295,13 +1296,6 @@ process(int argc, wchar_t ** argv) else { p = argv[1]; plen = wcslen(p); - if (p[0] != L'-') { - read_commands(); - maybe_handle_shebang(&argv[1], command); - } - /* No file with shebang, or an unrecognised shebang. - * Is the first arg a special version qualifier? - */ valid = (*p == L'-') && validate_version(&p[1]); if (valid) { ip = locate_python(&p[1]); @@ -1311,6 +1305,16 @@ installed", &p[1]); command += wcslen(p); command = skip_whitespace(command); } + else { + for (index = 1; index < argc; ++index) { + if (*argv[index] != L'-') + break; + } + if (index < argc) { + read_commands(); + maybe_handle_shebang(&argv[index], command); + } + } } if (!valid) { ip = locate_python(L""); @@ -1329,7 +1333,7 @@ installed", &p[1]); fwprintf(stdout, L"\ Python Launcher for Windows Version %s\n\n", version_text); fwprintf(stdout, L"\ -usage: %s [ launcher-arguments ] script [ script-arguments ]\n\n", argv[0]); +usage: %s [ launcher-arguments ] [ python-arguments ] script [ script-arguments ]\n\n", argv[0]); fputws(L"\ Launcher arguments:\n\n\ -2 : Launch the latest Python 2.x version\n\ @@ -1362,4 +1366,4 @@ int cdecl wmain(int argc, wchar_t ** argv) return process(argc, argv); } -#endif
\ No newline at end of file +#endif |