Skip to content
Merged
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
9 changes: 8 additions & 1 deletion website/public/install_roc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,14 @@ else
fi

# ---- Ask to add Roc to PATH ----
read -r -p "Would you like me to add Roc to your PATH automatically? [y/N] " ANSWER </dev/tty
ANSWER="n"
if [ -t 0 ] && [ -e /dev/tty ]; then
# Interactive terminal: prompt the user
read -r -p "Would you like me to add Roc to your PATH automatically? [y/N] " ANSWER </dev/tty
elif [ ! -t 0 ]; then
# Non-interactive with piped input (e.g., CI with <<< "y"): read from stdin
read -r ANSWER || ANSWER="n"
fi
if [ "$ANSWER" = "y" ] || [ "$ANSWER" = "Y" ]; then
# note: using printf here avoids a literal "\n" being written
printf '\nexport PATH="$PATH:%s"\n' "$INSTALL_DIR" >> "$PROFILE"
Expand Down