gcode_shell_command: make RUN_SHELL_COMMAND accept optional parameters

Thanks @lixxbox for that code
This commit is contained in:
th33xitus
2021-10-17 20:13:48 +02:00
committed by GitHub
parent 9b6925e9c4
commit f231fa9c69

View File

@@ -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))