SVGHMI: Do not generate Popen call when comamn is empty.
authorEdouard Tisserant <edouard@beremiz.fr>
Fri, 26 Apr 2024 12:14:52 +0200
changeset 3952 9719e0eeb6ff
parent 3938 fc4af5685aa3
child 3953 91c39139420f
SVGHMI: Do not generate Popen call when comamn is empty.
svghmi/svghmi.py
--- a/svghmi/svghmi.py	Fri Apr 26 09:24:26 2024 +0200
+++ b/svghmi/svghmi.py	Fri Apr 26 12:14:52 2024 +0200
@@ -643,10 +643,11 @@
         svghmi_cmds = {}
         for thing in ["Start", "Stop", "Watchdog"]:
              given_command = self.GetParamsAttributes("SVGHMI.On"+thing)["value"]
+             args = shlex.split(given_command.format(**svghmi_options))
              svghmi_cmds[thing] = (
                 "Popen(" +
-                repr(shlex.split(given_command.format(**svghmi_options))) +
-                ")") if given_command else "None # no command given"
+                repr(args) +
+                ")") if args else "None # no command given"
 
         runtimefile_path = os.path.join(buildpath, "runtime_%s_svghmi_.py" % location_str)
         runtimefile = open(runtimefile_path, 'w')