Skip to content

Commit 01161da

Browse files
committed
for consistency always use bash as shell, if available
1 parent fa05e7c commit 01161da

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

subprocess_with_resource_limits.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#
1010

1111
import asyncio, locale, re, os, resource, signal, subprocess, sys, tempfile, threading
12+
import shutil
1213

1314

1415
def run(command, **parameters):
@@ -87,7 +88,8 @@ def set_limits():
8788
os.nice(nice)
8889

8990
# Create the subprocess
90-
command = ["/bin/sh", "-c", command] if isinstance(command, str) else command
91+
# FIXME: There should be a parameter to control what shell to use
92+
command = ["/bin/sh" if shutil.which("bash") is None else shutil.which("bash"), "-c", command] if isinstance(command, str) else command
9193

9294
# subtle issue with providing string as input so just write it to a temporary file
9395
if stdin:

0 commit comments

Comments
 (0)