Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run python in the same process as eb wrapper script by using exec #4048

Merged
merged 3 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions easybuild/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@ def main(args=None, logfile=None, do_build=None, testing=False, modtool=None):
if 'CDPATH' in os.environ:
del os.environ['CDPATH']

# When EB is run via `exec` the special bash variable $_ is not set
# So emulate this here to allow (module) scripts depending on that to work
if '_' not in os.environ:
os.environ['_'] = sys.executable

# purposely session state very early, to avoid modules loaded by EasyBuild meddling in
init_session_state = session_state()

Expand Down
2 changes: 1 addition & 1 deletion eb
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ fi
export EB_SCRIPT_PATH="${0}"

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