From 20c79634716ecc790fb46fb26b7bcdd9bcbc23a4 Mon Sep 17 00:00:00 2001 From: Giuseppe Ruggiero <20145321+poe84it@users.noreply.github.com> Date: Sun, 14 Sep 2025 02:26:44 +0200 Subject: [PATCH] powerline-go: fix PROMPT_COMMAND duplicate in bash initialization (#7697) --- modules/programs/powerline-go.nix | 4 +++- tests/modules/programs/powerline-go/bash.nix | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/programs/powerline-go.nix b/modules/programs/powerline-go.nix index e523526a..1fd5268b 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 aead1a18..e7051829 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' ''; }