This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ambwrig
Recipients ambwrig
Date 2021-08-26.22:56:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1630018593.55.0.418512134995.issue45023@roundup.psfhosted.org>
In-reply-to
Content
The return code of python on linux/MacOS when the program is ended with a KeyboardInterrupt should be -2, when running with multiprocessing the exitcode is 1. I've attached a reproduced example. 

From The Process.join() docs: https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Process.exitcode

> A negative value -N indicates that the child was terminated by signal N.

output:

$ /usr/local/opt/python@3.9/bin/python3 -m test
Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/awright/docker/2108/test.py", line 49, in <module>
    sys.exit(main())
  File "/Users/awright/docker/2108/test.py", line 41, in main
    return target()
  File "/Users/awright/docker/2108/test.py", line 10, in target
    time.sleep(99999)
KeyboardInterrupt
proc.wait()=-2
Process SpawnProcess-1:
Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/awright/docker/2108/test.py", line 10, in target
    time.sleep(99999)
KeyboardInterrupt
proc.exitcode=1



See also: 
https://bugs.python.org/issue1054041 and https://bugs.python.org/issue41602
History
Date User Action Args
2021-08-26 22:56:33ambwrigsetrecipients: + ambwrig
2021-08-26 22:56:33ambwrigsetmessageid: <1630018593.55.0.418512134995.issue45023@roundup.psfhosted.org>
2021-08-26 22:56:33ambwriglinkissue45023 messages
2021-08-26 22:56:33ambwrigcreate