fix timeouts and pimcomp artifacts dir
Validate Operations / validate-operations (push) Has been cancelled
Validate Operations / validate-operations (push) Has been cancelled
This commit is contained in:
@@ -65,6 +65,7 @@ def _stream_output(fd, process, reporter, treat_eio_as_eof=False, stream_output=
|
||||
|
||||
|
||||
def run_command_with_reporter(cmd, cwd=None, reporter=None, capture_output=False, timeout_sec=None):
|
||||
effective_timeout_sec = None if timeout_sec == 0 else timeout_sec
|
||||
if reporter is None:
|
||||
if capture_output:
|
||||
completed = subprocess.run(
|
||||
@@ -73,10 +74,10 @@ def run_command_with_reporter(cmd, cwd=None, reporter=None, capture_output=False
|
||||
check=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
timeout=timeout_sec,
|
||||
timeout=effective_timeout_sec,
|
||||
)
|
||||
return completed.stdout.decode("utf-8", errors="replace")
|
||||
subprocess.run(cmd, cwd=cwd, check=True, timeout=timeout_sec)
|
||||
subprocess.run(cmd, cwd=cwd, check=True, timeout=effective_timeout_sec)
|
||||
return None
|
||||
|
||||
stream_output = bool(getattr(reporter, "verbose", False))
|
||||
@@ -86,7 +87,7 @@ def run_command_with_reporter(cmd, cwd=None, reporter=None, capture_output=False
|
||||
cwd=cwd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
timeout=timeout_sec,
|
||||
timeout=effective_timeout_sec,
|
||||
)
|
||||
if completed.returncode != 0:
|
||||
raise subprocess.CalledProcessError(completed.returncode, completed.args, output=completed.stdout)
|
||||
@@ -102,7 +103,7 @@ def run_command_with_reporter(cmd, cwd=None, reporter=None, capture_output=False
|
||||
stderr=subprocess.STDOUT,
|
||||
)
|
||||
assert process.stdout is not None
|
||||
output = _stream_output(process.stdout.fileno(), process, reporter, timeout_sec=timeout_sec)
|
||||
output = _stream_output(process.stdout.fileno(), process, reporter, timeout_sec=effective_timeout_sec)
|
||||
return output.decode("utf-8", errors="replace") if capture_output else None
|
||||
|
||||
try:
|
||||
@@ -115,5 +116,5 @@ def run_command_with_reporter(cmd, cwd=None, reporter=None, capture_output=False
|
||||
finally:
|
||||
os.close(slave_fd)
|
||||
|
||||
output = _stream_output(master_fd, process, reporter, treat_eio_as_eof=True, timeout_sec=timeout_sec)
|
||||
output = _stream_output(master_fd, process, reporter, treat_eio_as_eof=True, timeout_sec=effective_timeout_sec)
|
||||
return output.decode("utf-8", errors="replace") if capture_output else None
|
||||
|
||||
Reference in New Issue
Block a user