From fcf75cbec09e0b2296cd4facb56082d2e3852e15 Mon Sep 17 00:00:00 2001 From: Joe Koning Date: Wed, 17 Apr 2019 14:37:41 -0700 Subject: [PATCH 1/2] Take out shebang from shell definiton and at it when script is written. --- maestrowf/interfaces/script/localscriptadapter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maestrowf/interfaces/script/localscriptadapter.py b/maestrowf/interfaces/script/localscriptadapter.py index 3632531d4..ed455a7a0 100644 --- a/maestrowf/interfaces/script/localscriptadapter.py +++ b/maestrowf/interfaces/script/localscriptadapter.py @@ -55,7 +55,7 @@ def __init__(self, **kwargs): """ super(LocalScriptAdapter, self).__init__() - self._exec = kwargs.pop("shell", "#!/bin/bash") + self._exec = kwargs.pop("shell", "/bin/bash") def _write_script(self, ws_path, step): """ @@ -89,7 +89,7 @@ def _write_script(self, ws_path, step): restart_path = os.path.join(ws_path, rname) with open(restart_path, "w") as script: - script.write(self._exec) + script.write("#!"+self._exec) _ = "\n\n{}\n".format(restart) script.write(_) else: From 8167655d9053d5db3cc138a8e2d21cf806512121 Mon Sep 17 00:00:00 2001 From: Joe Koning Date: Wed, 17 Apr 2019 16:58:32 -0700 Subject: [PATCH 2/2] Include shebang in cmd and fix format of string written to file. --- maestrowf/interfaces/script/localscriptadapter.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/maestrowf/interfaces/script/localscriptadapter.py b/maestrowf/interfaces/script/localscriptadapter.py index e985b9a10..49a82a691 100644 --- a/maestrowf/interfaces/script/localscriptadapter.py +++ b/maestrowf/interfaces/script/localscriptadapter.py @@ -82,18 +82,14 @@ def _write_script(self, ws_path, step): fname = "{}.sh".format(step.name) script_path = os.path.join(ws_path, fname) with open(script_path, "w") as script: - script.write(self._exec) - _ = "\n\n{}\n".format(cmd) - script.write(_) + script.write("#!{0}\n\n{1}\n".format(self._exec, cmd)) if restart: rname = "{}.restart.sh".format(step.name) restart_path = os.path.join(ws_path, rname) with open(restart_path, "w") as script: - script.write("#!"+self._exec) - _ = "\n\n{}\n".format(restart) - script.write(_) + script.write("#!{0}\n\n{1}\n".format(self._exec, restart)) else: restart_path = None