exec/cmd.run_cmd(): add stderr
param
This commit is contained in:
parent
cc29b60f9f
commit
2535d6bbd8
1 changed files with 4 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue