Skip to content

Commit aa90ad3

Browse files
committed
fix: ignore KeyboardInterrupt during shutting down the pool
1 parent 633cc2e commit aa90ad3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

python/cocoindex/subprocess_exec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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(

python/cocoindex/tests/conftest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ def _cocoindex_env_fixture() -> typing.Generator[None, None, None]:
1010
print("Shutdown the subprocess pool at exit in hook.")
1111
import cocoindex.subprocess_exec
1212

13-
cocoindex.subprocess_exec.shutdown_pool_at_exit()
13+
try:
14+
cocoindex.subprocess_exec.shutdown_pool_at_exit()
15+
except KeyboardInterrupt:
16+
print("KeyboardInterrupt ignored.")
1417
except Exception:
1518
pass

0 commit comments

Comments
 (0)