File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -228,12 +228,15 @@ def run(
228228 disable_stdout_logging : bool = False ,
229229 disable_stderr_logging : bool = False ,
230230 exit_on_error : bool = False ,
231+ timeout : Optional [int ] = None ,
231232) -> subprocess .CompletedProcess :
232- """Wrapper for subprocess.run() to print our
233+ """Run a specified command.
233234
234235 Args:
235236 command (str): The shell command that is executed via subprocess.Popen.
236237 disable_stdout_logging (bool): Disable stdout logging when it is too much or handled by the caller.
238+ exit_on_error (bool): Exit program if the exit code of the command is not 0.
239+ timeout (Optional[int]): Optional timeout for the command.
237240
238241 Returns:
239242 subprocess.CompletedProcess: State
@@ -256,7 +259,8 @@ def run(
256259 log (line .rstrip ("\n " ))
257260 stderr += line
258261
259- exitcode = process .wait ()
262+ exitcode = process .wait (timeout = timeout )
263+
260264 if exit_on_error and exitcode != 0 :
261265 exit_process (exitcode )
262266
You can’t perform that action at this time.
0 commit comments