diff --git a/examples/shell_command/example_cmd.sh b/examples/shell_command/example_cmd.sh index e8ead38b8..ff250de46 100755 --- a/examples/shell_command/example_cmd.sh +++ b/examples/shell_command/example_cmd.sh @@ -1,5 +1,5 @@ #!/bin/sh # This script can be called by a PyDMShellCommand widget, -# allowing it to make use of command chaining and other Bash features. +# allowing it to make use of command chaining and other shell features. echo "Hello World!" && echo "Hello Again!" diff --git a/examples/shell_command/shell_command_bash.ui b/examples/shell_command/shell_command_bash.ui index a833d9cfd..7653570c6 100644 --- a/examples/shell_command/shell_command_bash.ui +++ b/examples/shell_command/shell_command_bash.ui @@ -39,7 +39,7 @@ - Bash Option Enabled + runCmdsInFullShell Option Enabled false @@ -56,9 +56,6 @@ false - - true - Are you sure you want to proceed? @@ -91,6 +88,9 @@ + + true + @@ -129,9 +129,6 @@ false - - false - Are you sure you want to proceed? @@ -164,6 +161,9 @@ + + false + @@ -189,9 +189,6 @@ false - - false - Are you sure you want to proceed? @@ -227,6 +224,9 @@ + + false + diff --git a/pydm/widgets/shell_command.py b/pydm/widgets/shell_command.py index 8d39cfd81..82b958f2e 100644 --- a/pydm/widgets/shell_command.py +++ b/pydm/widgets/shell_command.py @@ -68,8 +68,8 @@ def __init__( self.process = None self._show_icon = True self._redirect_output = False - # Bash allows for more options such as command chaining ("cmd1;cmd2", "cmd1 && cmd2", etc ...) - self._run_cmds_in_bash = False + # shell allows for more options such as command chaining ("cmd1;cmd2", "cmd1 && cmd2", etc ...) + self._run_cmds_in_full_shell = False self._password_protected = False self._password = "" @@ -129,27 +129,27 @@ def showConfirmDialog(self, value: bool) -> None: self._show_confirm_dialog = value @Property(bool) - def runCommandsInBash(self) -> bool: + def runCommandsInFullShell(self) -> bool: """ - Whether or not to run shell cmds with Popen's option to run them through a bash shell. + Whether or not to run cmds with Popen's option for running them through a shell subprocess. Returns ------- bool """ - return self._run_cmds_in_bash + return self._run_cmds_in_full_shell - @runCommandsInBash.setter - def runCommandsInBash(self, value: bool) -> None: + @runCommandsInFullShell.setter + def runCommandsInFullShell(self, value: bool) -> None: """ - Whether or not to run shell cmds with Popen's option to run them through a bash shell. + Whether or not to run cmds with Popen's option for running them through a shell subprocess. Parameters ---------- value : bool """ - if self._run_cmds_in_bash != value: - self._run_cmds_in_bash = value + if self._run_cmds_in_full_shell != value: + self._run_cmds_in_full_shell = value @Property(str) def confirmMessage(self) -> str: @@ -552,7 +552,7 @@ def execute_command(self, command: str) -> None: cmd = os.path.expanduser(os.path.expandvars(command)) args = shlex.split(cmd, posix="win" not in sys.platform) # when Bash enabled, Popen takes the cmds as a single string (not list) - if self._run_cmds_in_bash: + if self._run_cmds_in_full_shell: args = cmd try: logger.debug("Launching process: %s", repr(args)) @@ -566,7 +566,7 @@ def execute_command(self, command: str) -> None: if self._redirect_output: stdout = None self.process = subprocess.Popen( - args, stdout=stdout, stderr=subprocess.PIPE, env=env_var, shell=self._run_cmds_in_bash + args, stdout=stdout, stderr=subprocess.PIPE, env=env_var, shell=self._run_cmds_in_full_shell ) except Exception as exc: