From 776d0c2f636f6c3e7fb66eca92d87e53374724a7 Mon Sep 17 00:00:00 2001 From: Takuma Yoneda Date: Sun, 24 Dec 2023 15:25:22 -0600 Subject: [PATCH] simply use `#!/bin/{shell}` shebang --- lmn/runner.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lmn/runner.py b/lmn/runner.py index f5a8d82..394256d 100644 --- a/lmn/runner.py +++ b/lmn/runner.py @@ -288,10 +288,10 @@ def exec(self, cmd: str, relative_workdir, conf, env: Optional[dict] = None, slurm_options += sbatch_cmd.split('\n')[2:-2] # Strip `sbatch << EOF`, '#!/usr/bin/env/ bash', {cmd} and `EOF` exec_str = '\n'.join(( - # f'#!/usr/bin/env {s.shell}', # NOTE: without `-S` option, `bash -i` will be considered a single command and will end up in command not found. # Reference: https://unix.stackexchange.com/a/657774/556831 - f'#!/usr/bin/env -S {s.shell} -i', + # f'#!/usr/bin/env -S {s.shell} -i', + f'#!/bin/{s.shell} -i', # ^ This only works with a recent version of coreutils (8.30) and that cannot be taken for granted. *slurm_options, *exports, cmd @@ -370,7 +370,8 @@ def exec(self, cmd: str, relative_workdir, conf: PBSConfig, env: Optional[dict] exec_str = '\n'.join(( # NOTE: without `-S` option, `bash -i` will be considered a single command and will end up in command not found. # Reference: https://unix.stackexchange.com/a/657774/556831 - '#!/usr/bin/env -S bash -i' if interactive else '#!/usr/bin/env bash', + # '#!/usr/bin/env -S bash -i' if interactive else '#!/usr/bin/env bash', + f'#!/bin/{s.shell} -i', # ^ This only works with a recent version of coreutils (8.30) and that cannot be taken for granted. *slurm_options, *exports, cmd