summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorathenian200 <athenian200@outlook.com>2022-05-04 01:05:04 +0000
committerathenian200 <athenian200@outlook.com>2022-05-04 01:05:04 +0000
commit0de24cc207b9fbb198d2eaf34e5bae21089d20bd (patch)
tree30e8620b11a59942f1653d5fca98c2dae6e59eee
parentf41a43acf290c3a621f27816e999e151651a022c (diff)
parent28ad4a4b7c694513c2fc0e0e18e366d96ebeb399 (diff)
downloaduxp-0de24cc207b9fbb198d2eaf34e5bae21089d20bd.tar.gz
Merge pull request 'Allow /bin/sh to be used as a fallback value when SHELL is not set.' (#1888) from athenian200/UXP:shell_detection into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/1888
-rw-r--r--python/mach/mach/mixin/process.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/python/mach/mach/mixin/process.py b/python/mach/mach/mixin/process.py
index a6d3a2a1bb..b8f0eac029 100644
--- a/python/mach/mach/mixin/process.py
+++ b/python/mach/mach/mixin/process.py
@@ -17,14 +17,16 @@ from .logging import LoggingMixin
# Perform detection of operating system environment. This is used by command
-# execution. We only do this once to save redundancy. Yes, this can fail module
-# loading. That is arguably OK.
+# execution. We only do this once to save redundancy. Fall back to checking
+# existence of /bin/sh if environment detection fails.
if 'SHELL' in os.environ:
_current_shell = os.environ['SHELL']
elif 'MOZILLABUILD' in os.environ:
_current_shell = os.environ['MOZILLABUILD'] + '/msys/bin/sh.exe'
elif 'COMSPEC' in os.environ:
_current_shell = os.environ['COMSPEC']
+elif os.path.exists("/bin/sh"):
+ _current_shell = '/bin/sh'
else:
raise Exception('Could not detect environment shell!')