Installer: respect a declined Studio auto-start and keep Ctrl+C shutdown logs ordered
The `curl | sh` Studio auto-start prompt had two issues on Linux/macOS/WSL
(install.sh). install.ps1 already gates on input redirection, so Windows is
unaffected.
1. Typing n, or any closed/EOF /dev/tty, still launched Studio. The read
fallbacks defaulted to "y" (read failure, and the no-tty branch), so any
answer other than a cleanly delivered y/n line auto-started a blocking
foreground server. Default those to "n"; a real Enter still counts as yes
via ${_reply:-y}.
2. On Ctrl+C the shell prompt printed in the middle of Studio's shutdown logs.
The non-interactive installer shell took the default SIGINT action and died
before the child finished its graceful shutdown, so the prompt raced ahead
of "All subprocesses cleaned up". trap '' INT in the installer shell so it
waits for Studio's own graceful shutdown.
This commit is contained in:
parent
e83d4ae072
commit
3e4aca0346
1 changed files with 8 additions and 2 deletions
10
install.sh
10
install.sh
|
|
@ -3126,10 +3126,13 @@ echo ""
|
|||
if [ -t 1 ]; then
|
||||
echo ""
|
||||
printf " Start Unsloth Studio now? [Y/n] "
|
||||
# Default to NOT starting when no answer can be read (closed/EOF tty) so a
|
||||
# non-interactive caller is never trapped in a foreground server. A real
|
||||
# Enter still counts as yes via ${_reply:-y} below.
|
||||
if [ -r /dev/tty ]; then
|
||||
read -r _reply </dev/tty || _reply="y"
|
||||
read -r _reply </dev/tty || _reply="n"
|
||||
else
|
||||
_reply="y"
|
||||
_reply="n"
|
||||
fi
|
||||
case "${_reply:-y}" in
|
||||
[Yy]*|"")
|
||||
|
|
@ -3137,6 +3140,9 @@ if [ -t 1 ]; then
|
|||
# Detach stdin from the `curl | sh` pipe: as a foreground server the
|
||||
# studio would otherwise drain the rest of this piped script, leaving
|
||||
# the shell to die parsing the now-truncated tail (`unexpected fi`).
|
||||
# Ignore Ctrl+C so this shell waits for studio's own graceful
|
||||
# shutdown instead of dying first and racing the prompt over its logs.
|
||||
trap '' INT
|
||||
"$VENV_DIR/bin/unsloth" studio -p 8888 </dev/null
|
||||
_LAUNCH_EXIT=$?
|
||||
if [ "$_LAUNCH_EXIT" -ne 0 ] && [ "$_MIGRATED" = true ]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue