Skip to content

Problematic behavior with macOS Terminal related to disown in fish_git_prompt.fish #11181

@WinkelCode

Description

@WinkelCode

When starting a new Fish shell in Terminal, for example by opening a new tab with Command+T, the title bar will indicate that bash is running and trying to close the tab will show the "Closing this tab will terminate the running process bash." warning.

Running ps in this state shows the following:

$ ps
  PID TTY           TIME CMD
25211 ttys000    0:00.03 -fish
25219 ttys000    0:00.00 <defunct>

When the process disappears seems to be a bit random, usually it disappears when pressing enter, sometimes it disappears after a short while without it.

I am admittedly not sure what exactly is happening here, but after some troubleshooting, I found that commenting out this line:

disown $last_pid &>/dev/null

seems to fix the issue.

I also tried the following:

  • Replacing fish_prompt with a stub function fixes/avoids the issue.
    • Running fish_git_prompt manually can still trigger it.
  • I had an LLM add a bunch of echo commands throughout fish_prompt, which also "fixed" it.
    • Probably by slowing down the function, maybe the new blazingly-fast Rust code brought this issue to the surface?

Edit: I added a very short sleep to the end of fish_prompt and it indeed "fixed" the issue similar to the echos I mentioned above.

Edit 2:

$ fish -v
fish, version 4.0.0
$ which fish
/opt/homebrew/bin/fish

Issue started after the update to 4.0.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    regressionSomething that used to work, but was broken, especially between releases

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions