franciscolourenco / done

A fish-shell package to automatically receive notifications when long processes finish.
MIT License
766 stars 70 forks source link

Prevent inspecting a process that doesn't exist #123

Open joao-p-marques opened 2 years ago

joao-p-marques commented 2 years ago

Sometimes, the __done_is_tmux_window_active function will try to access the root process (PID 1). It is happening to me using byobu (tmux). When that happens(tmux_fish_pid=1), ps -o ppid= -p $tmux_fish_pid | string trim will return 0, causing a failure when we access basename (ps -o command= -p $tmux_fish_ppid) To ensure we don't get ugly errors if that is the case, we can check it we reached that case before checking the process' basename.

There might be a better solution, this is just a quick fix, so if someone with better fish skills has a better suggestion, I am open to changes :+1:

franciscolourenco commented 9 months ago

@peng1999 you wrote the original code. Do you understand why this is happening? Is tmux not being found and is the while loop running all the way until the end where pid = 0 ?

franciscolourenco commented 7 months ago

@joao-p-marques is there any chance that you are/were launching tmux with another path in the params? e.g.

/usr/bin/tmux new-session -c /some/start/dir

Asking to understand if this error might be fixed by https://github.com/franciscolourenco/done/pull/124

franciscolourenco commented 4 months ago

@joao-p-marques have you experienced this problem with the latest version?