charmbracelet / gum

A tool for glamorous shell scripts 🎀
MIT License
17.94k stars 339 forks source link

Using `wait` does nothing and `gum spin` exits immediately #262

Closed jakob1379 closed 1 year ago

jakob1379 commented 1 year ago

Describe the bug waiting for background processes ends instantly and gives exit code 1

To Reproduce

sleep 10m &
gum spin -- wait

[1] 1881548

Expected behavior A sweet, sweet spinner running until the wait command exits

Desktop (please complete the following information):

OS: Manjaro Linux x86_64
Host: 20NYSD4R05 ThinkPad T490s
Kernel: 5.15.85-1-MANJARO
Uptime: 1 day, 5 hours, 31 mins
Packages: 1880 (pacman), 10 (flatpak), 3 (snap)
Shell: bash 5.1.16
Resolution: 3440x1440
WM: i3
Theme: Adapta-Eta-Maia [GTK2/3]
Icons: Papirus-Maia [GTK2/3]
Terminal: alacritty
CPU: Intel i7-8665U (8) @ 4.800GHz
GPU: Intel WhiskeyLake-U GT2 [UHD Graphics 620]
Memory: 11088MiB / 15656MiB

I have read the previous issue https://github.com/charmbracelet/gum/issues/75 which makes sens, but this is a single command and even providing the PID of the background process does not work

rm-dr commented 1 year ago

This isn't a bug in gum, or in any other application. As such, this issue should probably be closed.

Even though sleep 10m & gum spin -- wait is one command, that wait will not work. wait can only wait for child processes, and sleep is not a child process of gum.

You could do a few things:

Pardon the hand-wavy explanation, I need do to some reading on child processes. In fact, you might want to do that too!

jakob1379 commented 1 year ago

If it simply requires I child process, that makes perfectly sense!

jakob1379 commented 1 year ago

I'll make a note to make a pull request