Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Child process of "gum spin" keeps running after ctrl-c if output is redirected #690

Open
ctn-malone opened this issue Oct 18, 2024 · 3 comments
Labels
bug Something isn't working cmd/spin

Comments

@ctn-malone
Copy link

ctn-malone commented Oct 18, 2024

Describe the bug

When killing gum spin -- xxx with ctrl-c, child process keeps running if stdout is redirected

To Reproduce

  • ping process will be killed when doing ctrl-c
gum spin --show-output -- ping -c 20 www.google.com
  • ping process will keep running when doing ctrl-c
gum spin --show-output -- ping -c 20 www.google.com >/tmp/log

Expected behavior

Child process should be killed when doing ctrl-c

Context

We have a QuickJS wrapper which relied on a spinner being displayed while a JS promise was executed. Since hitting ctrl-d does not stop the child program (which is tail -f in our case) anymore, when redirected, the cancellation is not detected when using gum >= 0.14 (except for 0.14.2)

The first gum example ported to QuickJS used to work fine and is now stuck once the spinner has disappeared, because the child process is still running

  • with gum 0.12
    Peek 2024-10-19 16-41
  • with gum 0.14.5
    Peek 2024-10-19 16-42

Desktop

  • OS: Ubuntu
  • Terminal: Konsole
  • Version: gum version 0.14.3,0.14.4,0.14.5 (0.14.2 and < 0.14 are ok)
@caarlos0 caarlos0 added cmd/spin bug Something isn't working labels Nov 18, 2024
@caarlos0
Copy link
Member

I think this might have been fixed by #732

@ctn-malone
Copy link
Author

At first glance, it looks promising, thanks a lot !. I'll run more tests in the next few days.

I also opened #733 to update the hash in default.nix

@ctn-malone
Copy link
Author

All good on my side. I noticed that when the output is redirected, content is buffered until the command is finished, even when --show-output is used. It's perfectly fine to me but it may be a problem for other users, since in 0.14.5, content was streamed even when redirecting output

Peek 2024-11-27 23-26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cmd/spin
Projects
None yet
Development

No branches or pull requests

2 participants