Skip to content

Commit d7fcf57

Browse files
fix: use login shell by default
1 parent 1c64a8f commit d7fcf57

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

snakemake_interface_software_deployment_plugins/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
ClassVar,
1515
Dict,
1616
Iterable,
17+
List,
1718
Optional,
1819
Self,
1920
Tuple,
@@ -138,7 +139,7 @@ class EnvBase(ABC):
138139
spec: EnvSpecBase
139140
within: Optional["EnvBase"]
140141
settings: Optional[SoftwareDeploymentSettingsBase]
141-
shell_executable: str
142+
shell_executable: List[str]
142143
tempdir: Path
143144
_cache_prefix: Path
144145
_deployment_prefix: Path
@@ -152,7 +153,7 @@ def __init__(
152153
spec: EnvSpecBase,
153154
within: Optional["EnvBase"],
154155
settings: Optional[SoftwareDeploymentSettingsBase],
155-
shell_executable: str,
156+
shell_executable: List[str],
156157
tempdir: Path,
157158
cache_prefix: Path,
158159
deployment_prefix: Path,
@@ -161,7 +162,7 @@ def __init__(
161162
self.spec: EnvSpecBase = spec
162163
self.within: Optional["EnvBase"] = within
163164
self.settings: Optional[SoftwareDeploymentSettingsBase] = settings
164-
self.shell_executable: str = shell_executable
165+
self.shell_executable = shell_executable
165166
self.tempdir = tempdir
166167
self._deployment_prefix: Path = deployment_prefix
167168
self._cache_prefix: Path = cache_prefix
@@ -236,9 +237,10 @@ def run_cmd(self, cmd: str, **kwargs) -> sp.CompletedProcess:
236237
237238
kwargs is passed to subprocess.run, shell=True is always set.
238239
"""
240+
assert "shell" not in kwargs, "shell argument has to be set to False"
239241
if self.within is not None:
240242
cmd = self.within.managed_decorate_shellcmd(cmd)
241-
return sp.run(cmd, shell=True, executable=self.shell_executable, **kwargs)
243+
return sp.run(self.shell_executable + [cmd], **kwargs)
242244

243245
def managed_decorate_shellcmd(self, cmd: str) -> str:
244246
cmd = self.decorate_shellcmd(cmd)

snakemake_interface_software_deployment_plugins/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
class TestSoftwareDeploymentBase(ABC):
2727
__test__ = False
28-
shell_executable = "bash"
28+
shell_executable = ["bash", "-i", "-c"]
2929

3030
@abstractmethod
3131
def get_env_spec(self) -> EnvSpecBase:

0 commit comments

Comments
 (0)