Prevent inspecting a process that doesn't exist#123
Open
joao-p-marques wants to merge 1 commit into
Open
Conversation
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`
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 ? |
Owner
|
@joao-p-marques is there any chance that you are/were launching tmux with another path in the params? e.g. Asking to understand if this error might be fixed by #124 |
Owner
|
@joao-p-marques have you experienced this problem with the latest version? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sometimes, the
__done_is_tmux_window_activefunction will try to access the root process (PID 1). It is happening to me usingbyobu(tmux).When that happens(
tmux_fish_pid=1),ps -o ppid= -p $tmux_fish_pid | string trimwill return0, causing a failure when we accessbasename (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
fishskills has a better suggestion, I am open to changes 👍