File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -244,11 +244,15 @@ def main(junit_xml: str | None,
244244
245245 failures = 0
246246
247+ orig_handler = signal .getsignal (signal .SIGINT )
248+
249+ def _restore_handler ():
250+ if orig_handler is not None :
251+ signal .signal (signal .SIGINT , orig_handler )
252+
247253 with Pool (processes = jobs ) as pool :
248254 ex = pool
249255
250- orig_handler = signal .getsignal (signal .SIGINT )
251-
252256 def shutdown_pool (_signum , _frame ):
253257 nonlocal ex
254258
@@ -263,7 +267,7 @@ def shutdown_pool(_signum, _frame):
263267 else :
264268 print ("Pool not found" )
265269
266- signal . signal ( signal . SIGINT , orig_handler )
270+ _restore_handler ( )
267271 raise SystemExit (shutdown_msg )
268272
269273 signal .signal (signal .SIGINT , shutdown_pool )
@@ -291,6 +295,7 @@ def shutdown_pool(_signum, _frame):
291295 shutdown_pool (None , None )
292296 finally :
293297 ex = None
298+ _restore_handler ()
294299 for p in projects :
295300 sh (["rm" , "-rf" , str (p / ".venv" )])
296301
You can’t perform that action at this time.
0 commit comments