Skip to content
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

Prevent inspecting a process that doesn't exist #123

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joao-p-marques
Copy link

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 👍

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`
@franciscolourenco
Copy link
Owner

@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
Copy link
Owner

franciscolourenco commented Nov 16, 2023

@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 #124

@franciscolourenco
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants