diff --git a/modules/programs/powerline-go.nix b/modules/programs/powerline-go.nix index e523526a8..1fd5268b3 100644 --- a/modules/programs/powerline-go.nix +++ b/modules/programs/powerline-go.nix @@ -165,7 +165,9 @@ in } if [ "$TERM" != "linux" ]; then - PROMPT_COMMAND="_update_ps1;$PROMPT_COMMAND" + if [[ ";''${PROMPT_COMMAND:-};" != *";_update_ps1;"* ]]; then + PROMPT_COMMAND="_update_ps1''${PROMPT_COMMAND:+;$PROMPT_COMMAND}" + fi fi ''; diff --git a/tests/modules/programs/powerline-go/bash.nix b/tests/modules/programs/powerline-go/bash.nix index aead1a180..e7051829a 100644 --- a/tests/modules/programs/powerline-go/bash.nix +++ b/tests/modules/programs/powerline-go/bash.nix @@ -26,5 +26,8 @@ assertFileContains \ home-files/.bashrc \ '/bin/powerline-go -error $old_exit_status -shell bash -modules nix-shell -newline -path-aliases \~/project/foo=prj-foo -ignore-repos /home/me/project1,/home/me/project2' + assertFileContains \ + home-files/.bashrc \ + 'if [[ ";''${PROMPT_COMMAND:-};" != *";_update_ps1;"* ]]; then' ''; }