From dc145eeea915036eee97c6766362955067ad84a1 Mon Sep 17 00:00:00 2001 From: Kiran Kumar Pradhan Date: Mon, 27 Jul 2026 16:18:14 +0000 Subject: [PATCH 1/2] Fix piped installer under nounset --- e2e/installer.bats | 9 +++++++++ scripts/install.sh | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/e2e/installer.bats b/e2e/installer.bats index a8175d95b..eb46b9b62 100644 --- a/e2e/installer.bats +++ b/e2e/installer.bats @@ -67,6 +67,15 @@ run_post_install_setup() { [[ "$output" != *"Basecamp CLI"* ]] # banner would print if main ran } +@test "install.sh runs main when piped to bash" { + # Keep PATH empty so main stops at its curl prerequisite without downloading + # anything or modifying the test environment. + run bash -c "cat '$INSTALL_SH' | PATH='$BATS_TEST_TMPDIR' /bin/bash" + [[ "$status" -ne 0 ]] + [[ "$output" == *"curl is required but not installed"* ]] + [[ "$output" != *"BASH_SOURCE[0]: unbound variable"* ]] +} + @test "new binary: post_install_setup dispatches to 'setup agents', never 'setup claude'" { run_post_install_setup [[ "$status" -eq 0 ]] diff --git a/scripts/install.sh b/scripts/install.sh index 4e915c19f..c03755439 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -542,6 +542,6 @@ post_install_setup() { # Guard so sourcing the script (e.g. from tests) doesn't run the installer. # The if-form is required: `[[ … ]] && main` returns 1 when sourced, which # trips `set -e` in the sourcing shell. -if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then +if [[ "${BASH_SOURCE[0]:-$0}" == "$0" ]]; then main "$@" fi From 0f3b638fbc124c2a237768553ec6e8389378a023 Mon Sep 17 00:00:00 2001 From: Kiran Kumar Pradhan Date: Mon, 27 Jul 2026 16:36:25 +0000 Subject: [PATCH 2/2] Use current Bash in installer regression test --- e2e/installer.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/installer.bats b/e2e/installer.bats index eb46b9b62..a19bee88a 100644 --- a/e2e/installer.bats +++ b/e2e/installer.bats @@ -70,7 +70,7 @@ run_post_install_setup() { @test "install.sh runs main when piped to bash" { # Keep PATH empty so main stops at its curl prerequisite without downloading # anything or modifying the test environment. - run bash -c "cat '$INSTALL_SH' | PATH='$BATS_TEST_TMPDIR' /bin/bash" + run bash -c "cat '$INSTALL_SH' | PATH='$BATS_TEST_TMPDIR' '$BASH'" [[ "$status" -ne 0 ]] [[ "$output" == *"curl is required but not installed"* ]] [[ "$output" != *"BASH_SOURCE[0]: unbound variable"* ]]