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

Kubetail kills parent shell #108

Open
wknapik opened this issue Nov 11, 2019 · 4 comments
Open

Kubetail kills parent shell #108

wknapik opened this issue Nov 11, 2019 · 4 comments

Comments

@wknapik
Copy link

wknapik commented Nov 11, 2019

If you call kubetail from a script, it will kill the script when it's done.

% sh -c 'echo shell pid $$; kubetail -k false -f false -s 1s >/dev/null; echo foo'
shell pid 31337
[1]    31337 terminated  sh -c 
%

This forces the user to trap TERM, to avoid failure during successful execution and consequently messes up signal handling in that script, which won't die when sent TERM from elsewhere.

See: https:/johanhaleby/kubetail/blob/master/kubetail#L277

@wknapik
Copy link
Author

wknapik commented Nov 11, 2019

Kubetail should kill its children before exiting, instead of killing the entire process group.

@johanhaleby
Copy link
Owner

johanhaleby commented Nov 11, 2019

@wknapik That makes sense. Could you help out with this?

@wknapik
Copy link
Author

wknapik commented Nov 11, 2019

@johanhaleby if it was a small fix, I'd submit a PR, but there's too much to change before this can be done properly.

I'd recommend cleaning up shellcheck findings and dropping the eval. Then fixing this will be easy.

@pmorch
Copy link

pmorch commented Apr 19, 2021

Other symptoms:

$ kubetail $args | less
<some output, but ends prematurely>

$ echo $?
15

Instead, I need to:

kubetail $args > file && less file

or better:

less -f <(kubetail $args)

This also fails:

$ kubetail $args | tail
[1]    7136 done        kubetail $args | 
       7137 terminated  tail

$ echo $?
143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants