Skip to content

Fix "There are still jobs active" on exit#72

Open
izzqz wants to merge 1 commit intojorgebucaran:mainfrom
izzqz:main
Open

Fix "There are still jobs active" on exit#72
izzqz wants to merge 1 commit intojorgebucaran:mainfrom
izzqz:main

Conversation

@izzqz
Copy link

@izzqz izzqz commented Jan 29, 2026

When the shell exits, the background git fetch process is still running
My git fetch pretty expensive so i got There are still jobs active message every time

Full error
There are still jobs active:

PID Command
2247724 fish --private --command "
set branch (
command git symbolic-ref --short HEAD 2>/dev/null ||
command git describe --tags --exact-match HEAD 2>/dev/null ||
command git rev-parse --short HEAD 2>/dev/null |
string replace --regex -- '(.+)' '@$1'
)

    test -z \"\$$_hydro_git\" && set --universal $_hydro_git \"\$branch \"

    command git diff-index --quiet HEAD 2>/dev/null
    test \$status -eq 1 ||
        count (command git ls-files --others --exclude-standard (command git rev-parse --show-toplevel)) >/dev/null && set info \"$hydro_symbol_git_dirty\"

    for fetch in $hydro_fetch false
        command git rev-list --count --left-right @{upstream}...@ 2>/dev/null |
            read behind ahead

        switch \"\$behind \$ahead\"
            case \" \" \"0 0\"
            case \"0 *\"
                set upstream \" $hydro_symbol_git_ahead\$ahead\"
            case \"* 0\"
                set upstream \" $hydro_symbol_git_behind\$behind\"
            case \*
                set upstream \" $hydro_symbol_git_ahead\$ahead $hydro_symbol_git_behind\$behind\"
        end

        set --universal $_hydro_git \"\$branch\$info\$upstream \"

        test \$fetch = true && command git fetch --no-tags 2>/dev/null
    end
" &

A second attempt to exit will terminate them.
Use 'disown PID' to remove jobs from the list without terminating them.

My patch just killing $_hydro_last_pid on _hydro_fish_exit

@jorgebucaran
Copy link
Owner

Hey, thanks. Don't you think this is a bit extreme? 😄

@auscompgeek
Copy link

FWIW I also occasionally get this even with the git fetch disabled, whenever I forget to wait a few seconds after returning to the prompt before exiting the shell.

I do agree interrupting a git fetch may be a bit extreme though…

@izzqz
Copy link
Author

izzqz commented Jan 30, 2026

Well... Yeah, but my thought process about this is: if we want to exit the shell, we should exit the shell. I tried disowning but its problematic see #22 and #20

So to keep things simple, we can just completely exterminate the background process. I dont think this approach would cause any problems

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

Successfully merging this pull request may close these issues.

3 participants