vimux icon indicating copy to clipboard operation
vimux copied to clipboard

Prevent errors when runner is closed by something other than vimux

Open mvanderkamp opened this issue 11 months ago • 1 comments

As seen in #236, if the runner was already manually closed when we call VimuxCloseRunner we get the following error:

Error detected while processing function VimuxCloseRunner[2]..VimuxTmux[8]..function VimuxCloseRunner[2]..VimuxTmux:
line    8:
E605: Exception not caught: Tmux command failed with message:can't find pane: %19^@
Error detected while processing function VimuxCloseRunner:
line    2:
E171: Missing :endif

This is an annoyance for people who use VimuxCloseOnExit. The error could spread to other commands as well, since the error prevents vimux from unsetting VimuxRunnerIndex, leading other commands to believe the runner is still available.

The error can occur in other contexts too, as seen in #229.

We generally only check if the VimuxRunnerIndex variable is defined before attempting to interact with the runner. This variable is only unset if vimux closes the runner, so any time anything else loses the runner we will get errors.

We have some options:

  1. Always check for the existence of the runner before interacting with it.
  2. Add try-catch blocks around each command to check for these errors.

I think for now I'll just enhance the checks we already have to make sure that the runner actually exists, rather than just checking for the index variable's existence.

mvanderkamp avatar Dec 07 '24 21:12 mvanderkamp

I've given this another pass to make the behaviour consistent across the commands and externally exposed functions.

@alerque Would you prefer to still get a chance to review my PRs?

Tagging a couple other people who might be interested in reviewing this:

  • @tscolari
  • @remko

mvanderkamp avatar May 25 '25 19:05 mvanderkamp

I've given this another pass to make the behaviour consistent across the commands and externally exposed functions.

@alerque Would you prefer to still get a chance to review my PRs?

No, if I'm pretty satisfied it is in good hands even if I don't have attention to give it at any given moment. Monitoring from the sidelines is good enough by me — if I can find the right settings far that.

Edit: Are you sure you can't override the need for a review already? It looks like I already made you an admin on this repo so you should have that option.

alerque avatar Jul 12 '25 21:07 alerque

Are you sure you can't override the need for a review already? It looks like I already made you an admin on this repo so you should have that option.

Yeah I can- I figured I should check before I start merging my work in without review though :grin: Thank you!

mvanderkamp avatar Jul 13 '25 01:07 mvanderkamp

No worries, use your judgement, that's why you have the buttons already. If you think something is questionable and want another pair of eyes feel free to explicitly push the "request review from" thing and hope it hits my radar. If it doesn't in a reasonable time frame don't sweat it. Pinging users that reported related issues can help too. But for any cases you're confident something is an clear win, has been tested, and/or you have feedback from other users, just merge at will. :rocket:

alerque avatar Jul 13 '25 09:07 alerque