python - Could not terminate process when use paramiko for command execution -
i have python script remote command execution, , want use multiprocessing in it.
i managed program working, when trying interrupt using ctrl+c, following exception, , program doesn't terminate correctly:
traceback (most recent call last): file "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap self.run() file "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run self._target(*self._args, **self._kwargs) file "/usr/lib/python2.7/multiprocessing/pool.py", line 102, in worker task = get() file "/usr/lib/python2.7/multiprocessing/queues.py", line 376, in return recv() keyboardinterrupt caught keyboardinterrupt, terminating workers
what doing wrong?
ctrl+c sends sigint
python process, triggers keyboardinterrupt
exception. here, parent process hits exception, , since not catching it, exits brutally, children.
if want handle ctrl+c, need catch keyboardinterrupt
exception in parent process. example given in this answer instance. if share code may find more specific case.
Comments
Post a Comment