diff --git a/autoload/nrepl/fireplace_connection.vim b/autoload/nrepl/fireplace_connection.vim index 538dd6b..eaa7d40 100644 --- a/autoload/nrepl/fireplace_connection.vim +++ b/autoload/nrepl/fireplace_connection.vim @@ -193,17 +193,18 @@ endfunction let s:keepalive = tempname() call writefile([getpid()], s:keepalive) -function! s:nrepl_command(args) dict abort +function! s:nrepl_command(cmd, args) dict abort return 'python' \ . ' ' . s:shellesc(s:python_dir.'/nrepl_fireplace.py') \ . ' ' . s:shellesc(self.host) \ . ' ' . s:shellesc(self.port) \ . ' ' . s:shellesc(s:keepalive) - \ . ' ' . join(map(copy(a:args), 's:shellesc(v:val)'), ' ') + \ . ' ' . s:shellesc(a:cmd) + \ . ' ' . join(map(copy(a:args), 's:shellesc(nrepl#fireplace_connection#bencode(v:val))'), ' ') endfunction -function! s:nrepl_dispatch(...) dict abort - let in = self.command(a:000) +function! s:nrepl_dispatch(cmd, ...) dict abort + let in = self.command(a:cmd, a:000) let out = system(in) if !v:shell_error return eval(out) diff --git a/python/nrepl_fireplace.py b/python/nrepl_fireplace.py index b058771..9721ea6 100644 --- a/python/nrepl_fireplace.py +++ b/python/nrepl_fireplace.py @@ -1,7 +1,9 @@ -import sys +import re import select import socket -import re +import sys + +from StringIO import StringIO def noop(): pass @@ -110,7 +112,7 @@ def dispatch(host, port, poll, keepalive, command, *args): def main(host, port, keepalive, command, *args): try: - sys.stdout.write(vim_encode(dispatch(host, port, noop, keepalive, command, *args))) + sys.stdout.write(vim_encode(dispatch(host, port, noop, keepalive, command, *[bdecode(StringIO(arg)) for arg in args]))) except Exception, e: print(e) exit(1)