From f231fa9c69191f23277b4e3319f6b675bfa0ee42 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sun, 17 Oct 2021 20:13:48 +0200 Subject: [PATCH] gcode_shell_command: make `RUN_SHELL_COMMAND` accept optional parameters Thanks @lixxbox for that code --- resources/gcode_shell_command.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/gcode_shell_command.py b/resources/gcode_shell_command.py index 85c1cb6..25f1095 100755 --- a/resources/gcode_shell_command.py +++ b/resources/gcode_shell_command.py @@ -46,10 +46,12 @@ class ShellCommand: cmd_RUN_SHELL_COMMAND_help = "Run a linux shell command" def cmd_RUN_SHELL_COMMAND(self, params): + gcode_params = params.get('PARAMS','') + gcode_params = shlex.split(gcode_params) reactor = self.printer.get_reactor() try: proc = subprocess.Popen( - self.command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + self.command + gcode_params, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) except Exception: logging.exception( "shell_command: Command {%s} failed" % (self.name))