Comments (6)
@tarruda @equalsraf
Any idea whether this is intentional behavior? Is it actually parsing the command and emulating a subshell on the vim end?
It is kind of a hack how vroom catches system calls, but we don't really have any better alternatives short of modifying vim. Maybe we could detect and handle neovim specially? I don't really want to try parsing commands looking for subshells in vroom, though.
from vroom.
Any idea whether this is intentional behavior? Is it actually parsing the command and emulating a subshell on the vim end?
As far as I know, no emulation is done on vim/nvim. system()
simply passes the input string to the shell, though in nvim this function was recently modified to use pipes for writing input and reading output(vim uses temporary files)
What command vroom sends to vim/nvim when it finds an expectation like ! (echo failed >&2 && exit 1) 2> /tmp/* (glob)
?
I wonder if this is related to #36. If so, maybe this will fix it
from vroom.
It evaluates to system('(echo failed >&2 && exit 1) 2> /tmp/nvimIOIkOk/2')
in both vim and nvim, with &shell set to shell.vroomfaker. Without the parentheses it works as expected, but with them it executes only what's inside the parentheses.
I'd be surprised if it was related to special characters, but we could always see if the fix for #36 makes any difference.
from vroom.
Does not seem to be related. Internally the command Neovim passes to os_system is
(echo failed >&2 && exit 1) 2> /tmp/foo
this in turn gets converted into
shell.vroomfaker -c (echo failed >&2 && exit 1) 2> /tmp/foo
Up to the point where uv_spawn()
is called. Command arguments also seem correct (-c is argv[1] and the remaining argv[2]).
I've added some debug statements to shell.vroomfaker, e.g. sys.argv is
sys.argv: shell.vroomfaker -c (echo failed >&2 && exit 1) 2> /tmp/foo
sys.argv[2]: (echo failed >&2 && exit 1) 2> /tmp/foo
command: echo failed >&2 && exit 1
Now the same debug statements for vim mode looks like this
sys.argv: shell.vroomfaker -c ((echo failed >&2 && exit 1) 2> /tmp/foo) > /tmp/v5bLAKo/0
sys.argv[2]: ((echo failed >&2 && exit 1) 2> /tmp/foo) > /tmp/v5bLAKo/0
command: (echo failed >&2 && exit 1) 2> /tmp/foo
Based on the comments in SplitCommand vroom seems to be extracting the contents of a parenthesis block on the assumption Vim calls (CMD) > TMPFILE
- except Neovim just passes the command without the parenthesis or the temp file redirect.
Is this it or did I miss something?
from vroom.
Not sure this is the preferred way to go about it but here is a quick fix to disable SplitCommand for Neovim using an environment variable
index 80e3dd6..50b8e6d 100755
--- a/scripts/shell.vroomfaker
+++ b/scripts/shell.vroomfaker
@@ -41,7 +41,10 @@ try:
controls = pickle.load(f)
# Parse the user command out from vim's gibberish.
- command, rebuild = vroom.vim.SplitCommand(sys.argv[2])
+ if os.getenv('VROOM_NEOVIM'):
+ command, rebuild = (sys.argv[2], lambda cmd: cmd)
+ else:
+ command, rebuild = vroom.vim.SplitCommand(sys.argv[2])
logs.append(vroom.test.Received(command))
handled = False
diff --git a/vroom/neovim_mod.py b/vroom/neovim_mod.py
index f50ec42..aececd7 100644
--- a/vroom/neovim_mod.py
+++ b/vroom/neovim_mod.py
@@ -21,6 +21,7 @@ class Communicator(VimCommunicator):
'-c', 'set shell=' + args.shell,
'-c', 'source %s' % CONFIGFILE]
env['NVIM_LISTEN_ADDRESS'] = args.servername
+ env['VROOM_NEOVIM'] = '1'
self.env = env
self._cache = {}
from vroom.
Thanks for digging into the details. Looks like a fine approach to me. Want to add some comments and send it as a pull req?
from vroom.
Related Issues (20)
- Vroom needs a logo / icon HOT 10
- Travis neovim builds timing out HOT 12
- Empty maktaba#buffer#Overwrite() sometimes hangs vroom
- Provide a simple reference to vroom syntax HOT 1
- Support for redir in vroom tests HOT 8
- Consider waiting a small extra delay for each syscall on commands with multiple syscalls
- Remove stderr output channel
- Parsing @do arguments is broken HOT 1
- Support bleeding-edge vim in Travis test matrix HOT 1
- Rewrite neovim_mod.py to use neovim's remote screen facility HOT 3
- Vroom tests hanging on Vim versions 7.4.1594 to 7.4.1657 HOT 5
- Vroom is using settings in ftplugin/ directory HOT 5
- v0.12.0 release doesn't work with current NeoVim HOT 4
- Add an option to trigger vim verbosefile logging
- System hijacks failing when using python 3.7 HOT 7
- Vroom fails in non-ANSI terminals with errors about missing color constants
- Support @skipif directive HOT 3
- Require explicit opt-in to run shell commands for real HOT 2
- Unusable since Neovim 0.8 HOT 5
- Update from Travis to GH Actions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vroom.