Comments (11)
You probably want :Start bash
rather than :Dispatch bash
, seeing as how it's an interactive command. Still, strange error. Do you have any mc
references in your bash config?
from vim-dispatch.
None. Is there a way to turn on some sort of logging to tell exactly what command/args are being run?
By the way, I forgot to mention it before but your plugin is awesome / very useful.
from vim-dispatch.
The closest thing I have found is some env function midnight-commander seems to put into my env. I do not use midnight-commander, but it is installed on this system.
mc=() { . /usr/share/mc/bin/mc-wrapper.sh
}
_=/usr/bin/env
Found via: http://stackoverflow.com/questions/9306717/malformed-environment-variables-detection-in-python
Do you read in the environment variables then try to duplicate them in some way?
from vim-dispatch.
Could it potentially be in autoload/dispatch.vim
function! dispatch#isolate(...)
let command = ['cd ' . shellescape(getcwd())]
for line in split(system('env'), "\n")
let var = matchstr(line, '^\w+\ze=')
if !empty(var) && var !=# '_'
if &shell =~# 'csh'
let command += ['setenv '.var.' '.shellescape(eval('$'.var))]
else
let command += ['export '.var.'='.shellescape(eval('$'.var))]
endif
endif
endfor
let command += a:000
let temp = tempname()
call writefile(command, temp)
return 'env -i ' . &shell . ' ' . temp
endfunction
It looks like you are duplicate the environment vars and assuming they are all on one line. But for some reason this one is not, and valid I guess.
from vim-dispatch.
Also, after doing 'unset mc'. Everything works fine. So that must be the culprit.
from vim-dispatch.
Perhaps listing getting the list of environment vars with something similar to:
http://stackoverflow.com/questions/11175842/how-to-list-all-the-environment-variables-in-vim
Then looping over them one by one would allow you to handle multi-line ones easier?
from vim-dispatch.
I don't think the environment variable listing in particular is the problem, as we're only matching lines containing =
, and getting the values directly from vim. What does :echo $mc
report? How about :echo shellescape($mc)
?
from vim-dispatch.
@tpope I've narrow this down to a problem with export
ed bash functions. I'm getting a similar issue with fzf which defines a bash function fzf
and exports it:
fzf() {
/usr/bin/ruby /Users/justin/.fzf/fzf "$@"
}
export -f fzf > /dev/null
Killing vim, then unset fzf
, then restarting Vim, allows :Make
to run without problems[1]. Non-exported functions aren't picked up by Vim's environment, so dispatch.vim doesn't have a problem with them.
I'm guessing that dispatch.vim's isolate()
logic introduced in #9 may be related. (Or it's a coincidence that @krismalfettone reported this a few days later.)
What does :echo $mc report? How about :echo shellescape($mc)?
In my case, :echo $fzf
gives:
() { /usr/bin/ruby /Users/justin/.fzf/fzf "$@"
}
:echo shellescape($fzf)
gives:
'() { /usr/bin/ruby /Users/justin/.fzf/fzf "$@"\
}'
[1] For reference: there is discussion on vim_dev about adding the ability to unset env vars from within vim: https://groups.google.com/d/msg/vim_dev/IIrDqVvdpOo/Q2nuImgZEtEJ
from vim-dispatch.
I've seen this shell escaping issue before. The only mystery to me is what the hell this weird function as environment variable thing is. Doesn't happen in zsh so I assume it's some bash misfeature.
from vim-dispatch.
Thanks, but I'm still getting unexpected EOF. If I open the temp file, I think I see the issue: a NUL byte is being written instead of a newline:
export fzf='() { /usr/bin/ruby /Users/justin/.fzf/fzf "$@"^@}'
from vim-dispatch.
It works. Thanks so much!
from vim-dispatch.
Related Issues (20)
- Vim hangs and process doesn't complete HOT 11
- Terminal strategy with debugger capability HOT 3
- Crazy characters from dotnet run inside tmux only HOT 1
- Cannot close last window HOT 4
- preemtively kill previous command before dispatching HOT 1
- ctrl-c of a ":Make" dispatched command immediately terminates command HOT 3
- Running dispatch in neovim opens quickfix list in vim pane not tmux HOT 2
- Running :Make resets `scrolloff` to 0 HOT 2
- The video on Vimeo is not rated. HOT 1
- [Question] Is there a configuration to jump from error to the existing buffer on a file? HOT 1
- Is one of the mappings supposed to run the last thing you dispatched? HOT 8
- [Feature Request] post hook for async commands HOT 1
- [Feature Request] customize exit_cb on terminal strategy HOT 8
- Have an option to use an interactive shell on :Dispatch HOT 3
- How check if the command succeeded? HOT 20
- Empty quickfix list with :Dispatch! and Make!
- Jump to errors produced by sanitizers and CTest
- How to properly filter output with errorformat HOT 1
- xterm/x11 strategy failing due to xterm which parses arguments badly argument parsing HOT 1
- Default flags for a command
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 vim-dispatch.