Skip to content

Commit

Permalink
simply use #!/bin/{shell} shebang
Browse files Browse the repository at this point in the history
  • Loading branch information
takuma-yoneda committed Dec 24, 2023
1 parent 36c94bb commit 776d0c2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lmn/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 776d0c2

Please sign in to comment.