def srun_out(command): """ Runs a shell command given as a `str` Returns: string with command's output Raises: `subprocess.CalledProcessError` when exit code != 0 """ return check_output(command, shell=True, universal_newlines=True, stderr=globals.std_err())
def srun_bg(command): """ Runs a shell command given as a `str` in the background Returns: (obj: `subprocess.Popen`) for executed process """ return Popen(command, shell=True, stdout=globals.std_out(), stderr=globals.std_err())
def srun(command): """ Runs a shell command given as a `str` Raises: `subprocess.CalledProcessError` when exit code != 0 """ return run(command, shell=True, stdout=globals.std_out(), stderr=globals.std_err(), check=True)