Skip to content

Commit 48b9210

Browse files
committed
Also rstrip other cmds, and shlex.quote jobscript
1 parent 706952e commit 48b9210

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

snakemake_executor_plugin_cluster_generic/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def run_job(self, job: JobExecutorInterface):
151151
ext_jobid = (
152152
subprocess.check_output(
153153
'{submitcmd} "{jobscript}"'.format(
154-
submitcmd=submitcmd.rstrip(), jobscript=jobscript
154+
submitcmd=submitcmd.rstrip(), jobscript=shlex.quote(jobscript)
155155
),
156156
shell=True,
157157
env=env,
@@ -201,7 +201,7 @@ def job_status(
201201
ret = subprocess.check_output(
202202
"{statuscmd} '{jobid}'".format(
203203
jobid=job_info.external_jobid,
204-
statuscmd=self.workflow.executor_settings.status_cmd,
204+
statuscmd=self.workflow.executor_settings.status_cmd.rstrip(),
205205
),
206206
shell=True,
207207
env=env,
@@ -299,7 +299,7 @@ def _chunks(lst, n):
299299
if self.sidecar_vars:
300300
env["SNAKEMAKE_CLUSTER_SIDECAR_VARS"] = self.sidecar_vars
301301
subprocess.check_call(
302-
[self.workflow.executor_settings.cancel_cmd] + chunk,
302+
[self.workflow.executor_settings.cancel_cmd.rstrip()] + chunk,
303303
shell=False,
304304
timeout=cancel_timeout,
305305
env=env,
@@ -369,7 +369,7 @@ def wait(executor, process):
369369

370370
self.logger.info("Launch sidecar process and read first output line.")
371371
process = subprocess.Popen(
372-
self.workflow.executor_settings.sidecar_cmd,
372+
self.workflow.executor_settings.sidecar_cmd.rstrip(),
373373
stdout=subprocess.PIPE,
374374
shell=False,
375375
encoding="utf-8",

0 commit comments

Comments
 (0)