From 2535d6bbd8a5adfb9dddf590b97e8526264a93c4 Mon Sep 17 00:00:00 2001 From: InsanePrawn Date: Tue, 16 Aug 2022 02:07:41 +0200 Subject: [PATCH] exec/cmd.run_cmd(): add `stderr` param --- exec/cmd.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/exec/cmd.py b/exec/cmd.py index 8d99f61..9e97c69 100644 --- a/exec/cmd.py +++ b/exec/cmd.py @@ -82,9 +82,10 @@ def run_cmd( attach_tty: bool = False, capture_output: bool = False, cwd: Optional[str] = None, - stdout: Optional[int] = None, switch_user: Optional[str] = None, elevation_method: Optional[ElevationMethod] = None, + stdout: Optional[int] = None, + stderr=None, ) -> Union[subprocess.CompletedProcess, int]: "execute `script` as `switch_user`, elevating and su'ing as necessary" kwargs: dict = {} @@ -94,6 +95,8 @@ def run_cmd( kwargs['env'] = env if not attach_tty: kwargs |= {'stdout': stdout} if stdout else {'capture_output': capture_output} + if stderr: + kwargs['stderr'] = stderr script = flatten_shell_script(script) if cwd: