Skip to content

Commit 75bf686

Browse files
committed
fix(uninstaller): avoid /dev/tty prompts in non-interactive runs
1 parent 8c29cce commit 75bf686

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

scripts/uninstall.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
set -Eeuo pipefail
33

4-
SCRIPT_VERSION="1.1.0"
4+
SCRIPT_VERSION="1.1.1"
55

66
SERVICE_NAME="${SERVICE_NAME:-multi-command-runner}"
77
INSTALL_DIR="${INSTALL_DIR:-/opt/multi-command-runner}"
@@ -82,6 +82,10 @@ prompt_yes_no() {
8282
done
8383
}
8484

85+
has_interactive_tty() {
86+
tty -s && [[ -r /dev/tty && -w /dev/tty ]]
87+
}
88+
8589
resolve_data_dir() {
8690
if [[ -z "${DATA_DIR}" && -f "${ENV_FILE}" ]]; then
8791
DATA_DIR="$(grep -E "^[[:space:]]*DATA_DIR=" "${ENV_FILE}" | tail -n 1 | cut -d'=' -f2- || true)"
@@ -103,7 +107,7 @@ configure_options() {
103107
if [[ "${FORCE}" == "1" ]]; then
104108
return
105109
fi
106-
if [[ ! -r /dev/tty || ! -w /dev/tty ]]; then
110+
if ! has_interactive_tty; then
107111
warn "No interactive TTY detected. Using default/specified uninstall options."
108112
return
109113
fi

0 commit comments

Comments
 (0)