X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=remote_worker.py;h=0086c40b0379ce680383c3b4e723bdc92b3bec0a;hb=f2c7c1a131d8846c15613125b6ed999724f0ab2f;hp=bf8de6c66a36767ac267cfdd2bffe38317cbace0;hpb=9821d383ba3de886f8d11d00a588e49c2c280579;p=python_utils.git diff --git a/remote_worker.py b/remote_worker.py index bf8de6c..0086c40 100755 --- a/remote_worker.py +++ b/remote_worker.py @@ -83,7 +83,9 @@ def main() -> None: in_file = config.config['code_file'] out_file = config.config['result_file'] - (thread, stop_thread) = watch_for_cancel() + stop_thread = None + if config.config['watch_for_cancel']: + (thread, stop_thread) = watch_for_cancel() logger.debug(f'Reading {in_file}.') try: @@ -129,8 +131,9 @@ def main() -> None: stop_thread.set() sys.exit(-1) - stop_thread.set() - thread.join() + if stop_thread is not None: + stop_thread.set() + thread.join() if __name__ == '__main__':