mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-25 00:11:28 +00:00
make interrupting less jank by making child processes ignore sigint
This commit is contained in:
parent
9765bd2561
commit
c3cc5d324a
1 changed files with 11 additions and 1 deletions
|
@ -302,6 +302,14 @@ def process_pool_wrapped(extraction_ctx, pd):
|
||||||
) from e
|
) from e
|
||||||
|
|
||||||
|
|
||||||
|
# Make interrupting jobs with ^C less jank
|
||||||
|
# https://stackoverflow.com/questions/72967793/keyboardinterrupt-with-python-multiprocessing-pool
|
||||||
|
def set_sigint_ignored():
|
||||||
|
import signal
|
||||||
|
|
||||||
|
signal.signal(signal.SIGINT, signal.SIG_IGN)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
|
@ -444,7 +452,9 @@ def main():
|
||||||
pools_desc_to_extract = pools_desc_modified
|
pools_desc_to_extract = pools_desc_modified
|
||||||
|
|
||||||
if pools_desc_to_extract:
|
if pools_desc_to_extract:
|
||||||
with multiprocessing.Pool(processes=args.jobs) as pool:
|
with multiprocessing.Pool(
|
||||||
|
processes=args.jobs, initializer=set_sigint_ignored
|
||||||
|
) as pool:
|
||||||
jobs = [
|
jobs = [
|
||||||
(
|
(
|
||||||
pd,
|
pd,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue