Skip to content

Only reassume control of term if all foreground jobs finished - #4242

Closed
faho wants to merge 3 commits into
fish-shell:masterfrom
faho:all-jobs-matter
Closed

faho wants to merge 3 commits into
fish-shell:masterfrom
faho:all-jobs-matter

Conversation

@faho

@faho faho commented Jul 25, 2017 •

Copy link
Copy Markdown
Member

Description

In some cases one process of a job quits early, and fish then reassumes control of the terminal. This is especially prevalent with while read loops (since every read only lasts for a single line).

We "fix" this by checking if all interactive jobs have finished before reassuming control. It's not a real fix (presumably that involves not considering the job finished in this case), but should be a good workaround.

Since this has some potential for breaking stuff, I'd appreciate some testing.

Fixes issue #4238.

TODOs:

  • [N/A] Changes to fish usage are reflected in user documentation/manpages.
  • Tests have been added for regressions fixed - this is kinda hard to test.
  • [N/A] User-visible changes noted in CHANGELOG.md

Since this is a bug-fix, I'd like to have it in 2.7.0.

@faho faho added the bug Something that's not working as intended label Jul 25, 2017
@faho faho added this to the fish 2.7.0 milestone Jul 25, 2017
Sorry!
@faho

faho commented Jul 25, 2017

Copy link
Copy Markdown
Member Author

Okay, this makes the ctrl-c test hang.

@faho faho closed this Jul 25, 2017
@faho faho reopened this Jul 25, 2017
@faho

faho commented Jul 25, 2017

Copy link
Copy Markdown
Member Author

So, I've tried a different fix:

Instead of checking all jobs, we now only take control of the terminal if the finished job had it to begin with. The assumption being that if that job didn't have it, and we don't have it, then whoever has it deserves it.

@faho

faho commented Jul 26, 2017

Copy link
Copy Markdown
Member Author

Close, but no cigar.

This improves the situation a tiny bit, but not enough for me to want to keep that hack.

@faho faho closed this Jul 26, 2017
@zanchey zanchey removed this from the fish 2.7.0 milestone Jul 26, 2017
@mqudsi

mqudsi commented Jul 30, 2017

Copy link
Copy Markdown
Contributor

Does #4268 affect the underlying problem here?

@faho

faho commented Jul 30, 2017

Copy link
Copy Markdown
Member Author

@mqudsi: It doesn't seem to. Like I've said, the issue is that the second read is put into a different job that is disassociated from the first. I don't think you've changed anything in that regard.

@mqudsi

mqudsi commented Jul 30, 2017

Copy link
Copy Markdown
Contributor

OK, thanks. I was wondering because I did change code that would have caused a SIGTTOU or SIGTTIN to be signaled for the main thread when marshaling child processes.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 17, 2020
@faho
faho deleted the all-jobs-matter branch June 16, 2022 08:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something that's not working as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants