diff --git a/unrpyc.py b/unrpyc.py index a78a4e4..2b2a3a8 100755 --- a/unrpyc.py +++ b/unrpyc.py @@ -260,7 +260,8 @@ def run_workers(worker, common_args, private_args, parallelism): results = [] if parallelism > 1: - with Pool(parallelism) as pool: + pool = Pool(parallelism) + try: for result in pool.imap(worker, worker_args, 1): results.append(result) @@ -269,6 +270,9 @@ def run_workers(worker, common_args, private_args, parallelism): print("") + finally: + pool.close() + else: for result in map(worker, worker_args): results.append(result)