X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/e4895820d9302048cc41e4b119450bbb8c01f70f..2887fa9c26cfd4ae6379e2cf4e6c5d50aaa0dd11:/crunch_scripts/run-command diff --git a/crunch_scripts/run-command b/crunch_scripts/run-command index a6c5ef981c..3fd08bf28b 100755 --- a/crunch_scripts/run-command +++ b/crunch_scripts/run-command @@ -1,4 +1,7 @@ #!/usr/bin/env python +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 import logging @@ -397,12 +400,19 @@ try: active = 1 pids = set([s.pid for s in subprocesses]) while len(pids) > 0: - (pid, status) = os.wait() - pids.discard(pid) - if not taskp.get("task.ignore_rcode"): - rcode[pid] = (status >> 8) + try: + (pid, status) = os.wait() + except OSError as e: + if e.errno == errno.EINTR: + pass + else: + raise else: - rcode[pid] = 0 + pids.discard(pid) + if not taskp.get("task.ignore_rcode"): + rcode[pid] = (status >> 8) + else: + rcode[pid] = 0 if sig.sig is not None: logger.critical("terminating on signal %s" % sig.sig)