summaryrefslogtreecommitdiff
path: root/startop/scripts/lib/cmd_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'startop/scripts/lib/cmd_utils.py')
-rw-r--r--startop/scripts/lib/cmd_utils.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/startop/scripts/lib/cmd_utils.py b/startop/scripts/lib/cmd_utils.py
index c3d96059c91c..bc5ca3140d3d 100644
--- a/startop/scripts/lib/cmd_utils.py
+++ b/startop/scripts/lib/cmd_utils.py
@@ -44,10 +44,16 @@ def run_shell_func(script_path: str,
A tuple of running status (True=succeeded, False=failed or timed out) and
std output (string contents of stdout with trailing whitespace removed) .
"""
- cmd = 'bash -c "source {script_path}; {func} {args}"'.format(
- script_path=script_path,
- func=func,
- args=' '.join("'{}'".format(arg) for arg in args))
+ if args:
+ cmd = 'bash -c "source {script_path}; {func} {args}"'.format(
+ script_path=script_path,
+ func=func,
+ args=' '.join("'{}'".format(arg) for arg in args))
+ else:
+ cmd = 'bash -c "source {script_path}; {func}"'.format(
+ script_path=script_path,
+ func=func)
+
print_utils.debug_print(cmd)
return run_shell_command(cmd)