The accepted answer to this question elaborates how the signal for a process exit can be determined on windows.
But if we launch python in the command line using python
And try to kill it using task manager or task kill like so:
taskkill /FI "IMAGENAME eq python.exe"
ERROR: The process with PID 5616 could not be terminated.
Reason: This process can only be terminated forcefully (with /F option).
Using the /F
option always sets the %errorlevel%
to 1.
Is there a way to terminate the python process on windows where the process return code retains the signal information.
EDIT 1: The comments and possible solution possible duplicates of this answer.