File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ def shutdown_pool_at_exit() -> None:
4545 if _pool is not None :
4646 try :
4747 print ("Before shutdown" )
48- _pool .shutdown (cancel_futures = True )
48+ _pool .shutdown (wait = True , cancel_futures = True )
4949 print ("After shutdown" )
5050 except Exception as e :
5151 _logger .error (
Original file line number Diff line number Diff line change 11import pytest
22import typing
3+ import os
4+ import signal
35
46
57@pytest .fixture (scope = "session" , autouse = True )
68def _cocoindex_env_fixture () -> typing .Generator [None , None , None ]:
79 """Shutdown the subprocess pool at exit."""
10+
811 yield
12+
913 try :
1014 print ("Shutdown the subprocess pool at exit in hook." )
1115 import cocoindex .subprocess_exec
1216
13- cocoindex .subprocess_exec .shutdown_pool_at_exit ()
14- except Exception :
17+ if os .name == "nt" :
18+ original_sigint_handler = signal .getsignal (signal .SIGINT )
19+ try :
20+ signal .signal (signal .SIGINT , signal .SIG_IGN )
21+ cocoindex .subprocess_exec .shutdown_pool_at_exit ()
22+ finally :
23+ try :
24+ signal .signal (signal .SIGINT , original_sigint_handler )
25+ except ValueError : # noqa: BLE001
26+ pass
27+ else :
28+ cocoindex .subprocess_exec .shutdown_pool_at_exit ()
29+ except (ImportError , AttributeError ): # noqa: BLE001
1530 pass
You can’t perform that action at this time.
0 commit comments