File tree 2 files changed +22
-1
lines changed
2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ function! go#tool#ExecuteInDir(cmd) abort
170
170
" that don't actually exist on the file system (e.g. vim-fugitive's
171
171
" GitDiff).
172
172
if ! isdirectory (expand (" %:p:h" ))
173
- let out = go#util#Exec (" false" )
173
+ let [ out, err] = go#util#Exec ([ " false" ] )
174
174
return out
175
175
endif
176
176
Original file line number Diff line number Diff line change
1
+ func ! Test_ExecuteInDir () abort
2
+ let l: tmp = gotest#write_file (' a/a.go' , [' package a' ])
3
+ try
4
+ let l: out = go#tool#ExecuteInDir (" pwd" )
5
+ call assert_equal (l: tmp . " /src/a\n " , l: out )
6
+ finally
7
+ call delete (l: tmp , ' rf' )
8
+ endtry
9
+ endfunc
10
+
11
+ func ! Test_ExecuteInDir_nodir () abort
12
+ let l: tmp = go#util#tempdir (" executeindir" )
13
+ exe ' :e ' . l: tmp . ' /new-dir/a'
14
+
15
+ try
16
+ let l: out = go#tool#ExecuteInDir (" pwd" )
17
+ call assert_equal (' ' , l: out )
18
+ finally
19
+ call delete (l: tmp , ' rf' )
20
+ endtry
21
+ endfunc
You can’t perform that action at this time.
0 commit comments