Merge pull request #169 from oahner/fix-portfile-issue

Register port file after connecting to port
This commit is contained in:
Tim Pope 2014-07-31 10:34:32 -04:00
commit b256399f3f

View File

@ -274,10 +274,11 @@ function! fireplace#register_port_file(portfile, ...) abort
endif endif
if empty(old) && getfsize(a:portfile) > 0 if empty(old) && getfsize(a:portfile) > 0
let port = matchstr(readfile(a:portfile, 'b', 1)[0], '\d\+') let port = matchstr(readfile(a:portfile, 'b', 1)[0], '\d\+')
let s:repl_portfiles[a:portfile] = {'time': getftime(a:portfile)}
try try
let conn = fireplace#nrepl_connection#open(port) let conn = fireplace#nrepl_connection#open(port)
let s:repl_portfiles[a:portfile].connection = conn let s:repl_portfiles[a:portfile] = {
\ 'time': getftime(a:portfile),
\ 'connection': conn}
call s:register_connection(conn, a:0 ? a:1 : '') call s:register_connection(conn, a:0 ? a:1 : '')
return conn return conn
catch /^nREPL Connection Error:/ catch /^nREPL Connection Error:/