Fix input prompt dropping issue in sanitize script
Add input buffer flush before each read prompt to prevent leftover keystrokes from auto-answering prompts. Also add small delay before reboot/shutdown prompts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -104,6 +104,8 @@ fi
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if [ "$AUTO_REBOOT" = false ]; then
|
if [ "$AUTO_REBOOT" = false ]; then
|
||||||
|
# Flush input buffer before prompt
|
||||||
|
read -t 0.1 -n 10000 discard </dev/tty 2>/dev/null || true
|
||||||
read -p "Continue? This cannot be undone! [y/N] " -n 1 -r </dev/tty
|
read -p "Continue? This cannot be undone! [y/N] " -n 1 -r </dev/tty
|
||||||
echo
|
echo
|
||||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||||
@@ -457,6 +459,9 @@ if [ "$SOFT_RESET" = true ]; then
|
|||||||
echo "Rebooting..."
|
echo "Rebooting..."
|
||||||
exec reboot
|
exec reboot
|
||||||
fi
|
fi
|
||||||
|
# Flush input buffer and pause before prompt
|
||||||
|
read -t 0.1 -n 10000 discard </dev/tty 2>/dev/null || true
|
||||||
|
sleep 0.3
|
||||||
read -p "Reboot now? [y/N] " -n 1 -r </dev/tty
|
read -p "Reboot now? [y/N] " -n 1 -r </dev/tty
|
||||||
echo
|
echo
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||||
@@ -476,6 +481,9 @@ else
|
|||||||
echo "Shutting down..."
|
echo "Shutting down..."
|
||||||
exec shutdown -h now
|
exec shutdown -h now
|
||||||
fi
|
fi
|
||||||
|
# Flush input buffer and pause before prompt
|
||||||
|
read -t 0.1 -n 10000 discard </dev/tty 2>/dev/null || true
|
||||||
|
sleep 0.3
|
||||||
read -p "Shut down now? [y/N] " -n 1 -r </dev/tty
|
read -p "Shut down now? [y/N] " -n 1 -r </dev/tty
|
||||||
echo
|
echo
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user