fix: read from /dev/tty fix for unix pipes (#1)

`read` from `/dev/tty` to present the user with an interactive shell when passed with a pipe.

Reviewed-on: https://codeberg.org/vegvisir/install/pulls/1
This commit is contained in:
Victor Westerlund 2025-03-05 11:03:55 +00:00
parent 658da80e03
commit 6be438b974

View file

@ -58,7 +58,7 @@ configure_vegvisir() {
# A configuration file already exists # A configuration file already exists
if [ -f "vegvisir/.env.ini" ] ; then if [ -f "vegvisir/.env.ini" ] ; then
echo "A Vegvisir configuration file already exists at: ${cwd}/vegvisir/.env.ini" echo "A Vegvisir configuration file already exists at: ${cwd}/vegvisir/.env.ini"
read -p "Do you want to overwrite this file? (y/n): " choice read -p "Do you want to overwrite this file? (y/n): " choice </dev/tty
# Check the user's response # Check the user's response
if [[ "$choice" == "y" || "$choice" == "Y" ]] ; then if [[ "$choice" == "y" || "$choice" == "Y" ]] ; then
@ -152,7 +152,7 @@ main() {
configure_vegvisir configure_vegvisir
echo "Vegvisir has been sucessfully installed." echo "Vegvisir has been sucessfully installed."
read -p "Do you want to generate a simple example website to start from? (y/n): " choice read -p "Do you want to generate a simple example website to start from? (y/n): " choice </dev/tty
# Check the user's response # Check the user's response
if [[ "$choice" == "y" || "$choice" == "Y" ]] ; then if [[ "$choice" == "y" || "$choice" == "Y" ]] ; then
@ -164,7 +164,7 @@ main() {
# Prompt the user for confirmation # Prompt the user for confirmation
echo "You are currently in: ${cwd}" echo "You are currently in: ${cwd}"
read -p "Do you want to proceed with the installation in this directory? (y/n): " choice read -p "Do you want to proceed with the installation in this directory? (y/n): " choice </dev/tty
# Check the user's response # Check the user's response
if [[ "$choice" == "y" || "$choice" == "Y" ]] ; then if [[ "$choice" == "y" || "$choice" == "Y" ]] ; then