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

We don't have a reliable way to tell when commands have finished executing #2

Open
Soares opened this issue Feb 24, 2014 · 5 comments

Comments

@Soares
Copy link
Contributor

Soares commented Feb 24, 2014

This single problem leads to a host of other issues. Mostly, it forces us to use arbitrary delays between commands (instead of having some way of knowing when commands are finished). This slows down the tests considerably.

Furthermore, it means that we can't reliably know whether messages were dropped or whether we just haven't waited long enough yet. Which sucks.

@AndrewRadev
Copy link

I'm the author of vimrunner, a project that also tries to drive Vim using the --remote interface.

My solution is to just always use --remote-expr for anything that requires confirmation, since it waits to return output. You can run normal-mode mappings by triggering --remote-expr with either feedkeys() or normal!, and you can run commands like :write by defining a vim-level function that executes the command.

The relevant code for commands is here. The VimrunnerEvaluateCommandOutput function is defined in Vimscript and also tries to capture any output from the command. I've had various issues with that and silent!, but that may not be interesting to you.

@dbarnett
Copy link
Contributor

Awesome, thanks! We were evaluating that approach, but hit some snags with special key codes, continued lines, and error handling and haven't finished getting something working yet. But glad to know it's feasible.

@AndrewRadev
Copy link

Yeah, escaping can be annoying when you pass things around a bunch of strings that are then given to arguments to functions that are then sent through the remote interface. I would suggest you browse through the relevant Vimrunner code, since it seems to be working well in practice (even so, I'd appreciate reports of any bugs/inconsistencies you notice in there :)).

@AndrewRadev
Copy link

Ah, also, just noticed you mentioned error handling. I may sit down and write a lengthy explanation of what I remember of my own problems/solutions in that area, but I'll see if I find the time.

@dbarnett
Copy link
Contributor

One special case I noticed is it seems to have trouble with executing shell commands in the foreground (with :!) that make it take slightly longer than our default neovim delay (example: https://travis-ci.org/github/bazelbuild/vim-bazel/jobs/756778325).

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

No branches or pull requests

3 participants