From d8af76edb4aca1b8dd13cb43e4e59203a93124aa Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Tue, 10 Sep 2024 15:15:46 -0400 Subject: [PATCH] fix: return empty string if capture_output=False --- src/ccbr_tools/shell.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ccbr_tools/shell.py b/src/ccbr_tools/shell.py index 85c98f4..d36dfd2 100644 --- a/src/ccbr_tools/shell.py +++ b/src/ccbr_tools/shell.py @@ -31,7 +31,10 @@ def shell_run(command_str, capture_output=True, check=True, shell=True, text=Tru command_str, capture_output=capture_output, shell=shell, text=text, check=check ) if capture_output: - return concat_newline(out.stdout, out.stderr) + return_val = concat_newline(out.stdout, out.stderr) + else: + return_val = "" + return return_val def exec_in_context(func: callable, *args: str, **kwargs: str):