Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cli/pkg/installscript/installscript.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
20 changes: 18 additions & 2 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,24 @@ 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}

# 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
# Get parent process name
PARENT_NAME=""
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

# Apply the default
if [ "$PARENT_NAME" != "rill" ]; then
NON_INTERACTIVE=${NON_INTERACTIVE:-true}
fi
fi
NON_INTERACTIVE=${NON_INTERACTIVE:-false}

Expand Down
Loading