Skip to content

Commit c84d1ac

Browse files
authored
Merge pull request #4048 from Flamefire/patch-1
run python in the same process as `eb` wrapper script by using `exec`
2 parents ceacc04 + b8402b4 commit c84d1ac

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

easybuild/main.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,11 @@ def main(args=None, logfile=None, do_build=None, testing=False, modtool=None):
230230
if 'CDPATH' in os.environ:
231231
del os.environ['CDPATH']
232232

233+
# When EB is run via `exec` the special bash variable $_ is not set
234+
# So emulate this here to allow (module) scripts depending on that to work
235+
if '_' not in os.environ:
236+
os.environ['_'] = sys.executable
237+
233238
# purposely session state very early, to avoid modules loaded by EasyBuild meddling in
234239
init_session_state = session_state()
235240

eb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,4 @@ fi
125125
export EB_SCRIPT_PATH="${0}"
126126

127127
verbose "${PYTHON} -m ${EASYBUILD_MAIN} ${*}"
128-
"${PYTHON}" -m "${EASYBUILD_MAIN}" "${@}"
128+
exec "${PYTHON}" -m "${EASYBUILD_MAIN}" "${@}"

0 commit comments

Comments
 (0)