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

SIGINT swallowed when running non-interactively #5253

Closed
mqudsi opened this Issue Oct 13, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@mqudsi
Copy link
Contributor

mqudsi commented Oct 13, 2018

Typing the following in at an interactive prompt, hitting enter, then ^C works (i.e. it stops);

while true
    echo hi
end

but execute the following script and try to stop it with ctrl+c and it never stops:

#!build/fish
while true
    echo hi
end

But it can be backgrounded via ctrl+z, so it's not that signals are blocked, the issue appears to be specific to ctrl+c.

@ridiculousfish

This comment has been minimized.

Copy link
Member

ridiculousfish commented Oct 13, 2018

Ugh, thanks for writing this up.

@ridiculousfish

This comment has been minimized.

Copy link
Member

ridiculousfish commented Oct 13, 2018

In non-interactive mode, fish squashes SIGINT and instead looks at the exit status of external commands. But if SIGINT arrives while fish is in the foreground then the signal will be dropped. In this case we're only executing builtins so fish is always in the foreground.

Let's just try allowing SIGINT to trigger cancellation.

@ridiculousfish ridiculousfish added this to the fish-3.0 milestone Oct 13, 2018

@mqudsi

This comment has been minimized.

Copy link
Contributor

mqudsi commented Oct 13, 2018

Thanks @ridiculousfish, that was fast.

ridiculousfish added a commit to ridiculousfish/fish-shell that referenced this issue Nov 24, 2018

Allow SIGINT in non-interactive mode
Prior to this fix, fish would swallow SIGINT in non-interactive mode. This
meant that scripts could only be Ctrl-C'd if fish was executing an external
command.

Unblock SIGINT in non-interactive mode.

Fixes fish-shell#5253
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment