Skip to content

Make EESSI_MODULE_UPDATE_PS1 configurable#188

Closed
adammccartney wants to merge 4 commits intoEESSI:mainfrom
adammccartney:fix/eessi_module_update_ps1
Closed

Make EESSI_MODULE_UPDATE_PS1 configurable#188
adammccartney wants to merge 4 commits intoEESSI:mainfrom
adammccartney:fix/eessi_module_update_ps1

Conversation

@adammccartney
Copy link
Copy Markdown
Contributor

Fixes #187

else
export EESSI_MODULE_UPDATE_PS1=1
fi
fi
Copy link
Copy Markdown
Member

@ocaisa ocaisa Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were changes today and I suggest you start again from https://github.com/EESSI/software-layer-scripts/blob/main/init/lmod/sh.

General approach looks ok, but if you call the script twice the EESSI_MODULE_UPDATE_PS1 will be set on the second call. You probably want a structure similar to

if [ -z "$__Init_EESSI_PS1" ]; then
  export __Init_EESSI_PS1=1;
  ...
fi

You should also add a test for this case near https://github.com/EESSI/software-layer-scripts/blob/main/.github/workflows/scripts/test_init_scripts.sh#L145-L153

Copy link
Copy Markdown
Member

@ocaisa ocaisa Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the test it could be

TEST_EESSI_EXPLICIT_NO_PS1_UPDATE=$($shell -c "unset PS1 ; PS1='$ ' ; export EESSI_MODULE_UPDATE_PS1=0 ; . init/lmod/$shell 2>/dev/null ; echo \"\$PS1\"")
TEST_EESSI_EXPLICIT_NO_PS1_UPDATE_CALLED_TWICE=$($shell -c "unset PS1 ; PS1='$ ' ; export EESSI_MODULE_UPDATE_PS1=0 ; . init/lmod/$shell 2>/dev/null ; . init/lmod/$shell 2>/dev/null ; echo \"\$PS1\"")
...
assert_raises 'echo "$TEST_EESSI_EXPLICIT_NO_PS1_UPDATE" | grep "$pattern"' 1
assert_raises 'echo "$TEST_EESSI_EXPLICIT_NO_PS1_UPDATE_CALLED_TWICE" | grep "$pattern"' 1

@adammccartney
Copy link
Copy Markdown
Contributor Author

closed by #192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make EESSI_MODULE_UPDATE_PS1 configurable

2 participants