Skip to content

Commit c49c3a3

Browse files
authored
Fix non-interactive scenario (#1235)
1 parent 60fc5d3 commit c49c3a3

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

install.sh

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,24 @@ else
3333
USE_SUDO=false
3434
fi
3535

36-
# Check if docs-builder already exists
36+
# Check if docs-builder already exists, but handle non-interactive shells
3737
if [ -f "$INSTALL_DIR/docs-builder" ]; then
3838
echo "docs-builder is already installed."
39-
printf "Do you want to update/overwrite it? (y/n): "
40-
read choice
41-
case "$choice" in
42-
y|Y ) echo "Updating docs-builder..." ;;
43-
n|N ) echo "Installation aborted."; exit 0 ;;
44-
* ) echo "Invalid choice. Installation aborted."; exit 1 ;;
45-
esac
39+
40+
# Check if script is running interactively (has a TTY)
41+
if [ -t 0 ]; then
42+
# Running interactively, can prompt for input
43+
printf "Do you want to update/overwrite it? (y/n): "
44+
read choice
45+
case "$choice" in
46+
y|Y ) echo "Updating docs-builder..." ;;
47+
n|N ) echo "Installation aborted."; exit 0 ;;
48+
* ) echo "Invalid choice. Installation aborted."; exit 1 ;;
49+
esac
50+
else
51+
# Non-interactive mode (e.g., piped from curl), default to yes
52+
echo "Running in non-interactive mode. Proceeding with installation..."
53+
fi
4654
fi
4755

4856
echo "Downloading docs-builder for $OS/$ARCH..."

0 commit comments

Comments
 (0)