From 2534f5b6bde3a4a20173074f2e6145bf43fdd38c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Egelund-M=C3=BCller?= Date: Fri, 13 Mar 2026 15:32:06 +0000 Subject: [PATCH 1/4] Fix interactivity in `rill upgrade` --- cli/pkg/installscript/installscript.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cli/pkg/installscript/installscript.go b/cli/pkg/installscript/installscript.go index c7ca38210d3..a997405593f 100644 --- a/cli/pkg/installscript/installscript.go +++ b/cli/pkg/installscript/installscript.go @@ -26,6 +26,7 @@ func execScript(ctx context.Context, version string, args ...string) error { scriptArgs := append([]string{script}, args...) cmd := exec.CommandContext(ctx, "/bin/sh", scriptArgs...) + cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr return cmd.Run() From f2657885c938c40904701081193d7e6f936f3eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Egelund-M=C3=BCller?= Date: Fri, 13 Mar 2026 15:37:35 +0000 Subject: [PATCH 2/4] Preserve interactivity in install.sh when parent process is rill --- scripts/install.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index 2ae400d2d43..54c86a3b8d6 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -304,7 +304,17 @@ set -e # Default values INSTALL_DIR_EXPLICIT=false if ! [ -t 0 ]; then # Detect non-interactive environments (e.g. piped input, CI, subprocesses) - NON_INTERACTIVE=${NON_INTERACTIVE:-true} + # When invoked as a subprocess of the Rill CLI (e.g. `rill upgrade`), stay interactive. + # Older versions of Rill don't pass stdin through, but the user is still at a terminal. + PARENT_NAME="" + if [ -f "/proc/$PPID/comm" ]; then + PARENT_NAME=$(cat "/proc/$PPID/comm" 2>/dev/null) + elif command -v ps >/dev/null 2>&1; then + PARENT_NAME=$(ps -o comm= -p "$PPID" 2>/dev/null) + fi + if [ "$(basename "$PARENT_NAME" 2>/dev/null)" != "rill" ]; then + NON_INTERACTIVE=${NON_INTERACTIVE:-true} + fi fi NON_INTERACTIVE=${NON_INTERACTIVE:-false} From 71e0b8b532ff63b477f2a50e50000b2a1d143c4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Egelund-M=C3=BCller?= Date: Fri, 13 Mar 2026 15:45:50 +0000 Subject: [PATCH 3/4] Cleaner comment --- scripts/install.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 54c86a3b8d6..f828e876557 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -303,9 +303,11 @@ set -e # Default values INSTALL_DIR_EXPLICIT=false -if ! [ -t 0 ]; then # Detect non-interactive environments (e.g. piped input, CI, subprocesses) - # When invoked as a subprocess of the Rill CLI (e.g. `rill upgrade`), stay interactive. - # Older versions of Rill don't pass stdin through, but the user is still at a terminal. + +# Default to non-interactive if STDIN is not a terminal (usually indicates e.g. agent, CI, subprocess). +if ! [ -t 0 ]; then + # Backwards compatibility: old versions of `rill upgrade` didn't pass STDIN through. + # So we stay interactive if the parent process is `rill`. PARENT_NAME="" if [ -f "/proc/$PPID/comm" ]; then PARENT_NAME=$(cat "/proc/$PPID/comm" 2>/dev/null) From 87dcca4d507379b3986e35149b6d42945fe37f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Egelund-M=C3=BCller?= Date: Fri, 13 Mar 2026 15:56:02 +0000 Subject: [PATCH 4/4] Add PPID guard and move basename inline in parent process check --- scripts/install.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index f828e876557..29720928ea5 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -305,16 +305,20 @@ set -e INSTALL_DIR_EXPLICIT=false # Default to non-interactive if STDIN is not a terminal (usually indicates e.g. agent, CI, subprocess). +# Backwards compatibility: Old versions of `rill upgrade` didn't pass STDIN through, so we stay interactive if the parent process is named `rill`. if ! [ -t 0 ]; then - # Backwards compatibility: old versions of `rill upgrade` didn't pass STDIN through. - # So we stay interactive if the parent process is `rill`. + # Get parent process name PARENT_NAME="" - if [ -f "/proc/$PPID/comm" ]; then - PARENT_NAME=$(cat "/proc/$PPID/comm" 2>/dev/null) - elif command -v ps >/dev/null 2>&1; then - PARENT_NAME=$(ps -o comm= -p "$PPID" 2>/dev/null) + if [ -n "$PPID" ]; then + if [ -f "/proc/$PPID/comm" ]; then + PARENT_NAME=$(basename "$(cat "/proc/$PPID/comm" 2>/dev/null)" 2>/dev/null) + elif command -v ps >/dev/null 2>&1; then + PARENT_NAME=$(basename "$(ps -o comm= -p "$PPID" 2>/dev/null)" 2>/dev/null) + fi fi - if [ "$(basename "$PARENT_NAME" 2>/dev/null)" != "rill" ]; then + + # Apply the default + if [ "$PARENT_NAME" != "rill" ]; then NON_INTERACTIVE=${NON_INTERACTIVE:-true} fi fi