-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
os.execvp on windows doesn't wait for the executed program to finish and doesn't report it's exit code #101191
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
The POSIX If we were to implement our own versions of This would still be very far from truly emulating an Base API
Handle API Process and Thread API
Memory API
Process Snapshotting API Process Status API
Tool Help API |
Thank you for the detailed analysis. I looked into how perl handles exec on windows, and it calls _execvp - can Python just do the same thing as perl? https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/execvp-wexecvp?view=vs-2019 |
All of the C runtime's Python uses |
Would it make sense to put a big warning in the corresponding docs? Currently it says:
[...]
Maybe one could clarify that it does not work as described on Windows (and point to Popen as the next best alternative) |
It seems this issue has been reported before in #63323. |
…mgrep/semgrep-proprietary#3171) On Windows, the execvp function doesn't replace the current process with the new process. The function spawns a new process in the background and control is returned to the caller [1][2], breaking the CLI interactivity. This commit switches to spawning another process both in the Python and OCaml code for better CLI interactivity on Windows. Unix.execv's documentation[3] recommends using Unix.create_process, but this commit uses Bos.OS.Cmd.run since similar approaches are already being used to spawn other processes and capture their output, etc. [1] - https://bugs.python.org/issue9148 [2] - python/cpython#101191 (comment) [3] - https://ocaml.org/manual/5.2/api/Unix.html#VALexecv synced from Pro 539bd07bda6a46c99d73002b18e273d0cabbe03d
…mgrep/semgrep-proprietary#3171) On Windows, the execvp function doesn't replace the current process with the new process. The function spawns a new process in the background and control is returned to the caller [1][2], breaking the CLI interactivity. This commit switches to spawning another process both in the Python and OCaml code for better CLI interactivity on Windows. Unix.execv's documentation[3] recommends using Unix.create_process, but this commit uses Bos.OS.Cmd.run since similar approaches are already being used to spawn other processes and capture their output, etc. [1] - https://bugs.python.org/issue9148 [2] - python/cpython#101191 (comment) [3] - https://ocaml.org/manual/5.2/api/Unix.html#VALexecv synced from Pro 539bd07bda6a46c99d73002b18e273d0cabbe03d
…mgrep/semgrep-proprietary#3171) On Windows, the execvp function doesn't replace the current process with the new process. The function spawns a new process in the background and control is returned to the caller [1][2], breaking the CLI interactivity. This commit switches to spawning another process both in the Python and OCaml code for better CLI interactivity on Windows. Unix.execv's documentation[3] recommends using Unix.create_process, but this commit uses Bos.OS.Cmd.run since similar approaches are already being used to spawn other processes and capture their output, etc. [1] - https://bugs.python.org/issue9148 [2] - python/cpython#101191 (comment) [3] - https://ocaml.org/manual/5.2/api/Unix.html#VALexecv synced from Pro 539bd07bda6a46c99d73002b18e273d0cabbe03d
…mgrep/semgrep-proprietary#3171) On Windows, the execvp function doesn't replace the current process with the new process. The function spawns a new process in the background and control is returned to the caller [1][2], breaking the CLI interactivity. This commit switches to spawning another process both in the Python and OCaml code for better CLI interactivity on Windows. Unix.execv's documentation[3] recommends using Unix.create_process, but this commit uses Bos.OS.Cmd.run since similar approaches are already being used to spawn other processes and capture their output, etc. [1] - https://bugs.python.org/issue9148 [2] - python/cpython#101191 (comment) [3] - https://ocaml.org/manual/5.2/api/Unix.html#VALexecv synced from Pro 539bd07bda6a46c99d73002b18e273d0cabbe03d
Bug report
os.execvp on windows doesn't wait for the executed program to finish and doesn't report it's exit code. Code:
bat file:
Output from command prompt:
Note the command prompt prompted me for a new command before the exec'd process wrote out it's message.
Your environment
The text was updated successfully, but these errors were encountered: