Skip to content

Make EESSI_MODULE_UPDATE_PS1 configurable#188

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

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

Fixes #187

else
export EESSI_MODULE_UPDATE_PS1=1
fi
fi
Copy link
Member

Choose a reason for hiding this comment

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

There were changed 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
Member

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\"")
...
assert_raises 'echo "$TEST_EESSI_EXPLICIT_NO_PS1_UPDATE" | grep "$pattern"' 1

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