Skip to content

Commit 25dbd44

Browse files
kylemclarenclaude
andcommitted
Fix: skip hostname prompt when piped
Only show interactive prompt when stdin is a terminal. When piped, use SPRITEDROP_HOSTNAME env var or auto-generate. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f7074be commit 25dbd44

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

install.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,17 @@ prompt_hostname() {
147147
# Skip if already authenticated
148148
tailscale status > /dev/null 2>&1 && return 0
149149

150-
echo ""
151-
echo -e " ${DIM}Enter a hostname for this device in your tailnet${NC}"
152-
echo -e " ${DIM}(e.g., sprite-myproject, sprite-api)${NC}"
153-
echo ""
154-
read -p " Hostname [Enter to auto-generate]: " input_hostname
155-
156-
if [ -n "$input_hostname" ]; then
157-
TS_HOSTNAME="$input_hostname"
150+
# Only prompt if running interactively (not piped)
151+
if [ -t 0 ]; then
152+
echo ""
153+
echo -e " ${DIM}Enter a hostname for this device in your tailnet${NC}"
154+
echo -e " ${DIM}(e.g., sprite-myproject, sprite-api)${NC}"
155+
echo ""
156+
read -p " Hostname [Enter to auto-generate]: " input_hostname
157+
158+
if [ -n "$input_hostname" ]; then
159+
TS_HOSTNAME="$input_hostname"
160+
fi
158161
fi
159162
}
160163

0 commit comments

Comments
 (0)