我不知道';我不明白为什么Vim脚本中的job_start会发生这种情况?
使用file选项执行我不知道';我不明白为什么Vim脚本中的job_start会发生这种情况?,vim,Vim,使用file选项执行job\u start,将在文件中获得结果 比如说, function hoge() let cmd = 'grep -nr hoge .' let option = { 'exit_cb': function('s:aaa'), \ 'out_io': 'file', \ 'out_name': '~/test'} call job_start(['/bin/sh', '-c', cmd], option) endfunc
job\u start
,将在文件中获得结果
比如说,
function hoge()
let cmd = 'grep -nr hoge .'
let option = { 'exit_cb': function('s:aaa'),
\ 'out_io': 'file',
\ 'out_name': '~/test'}
call job_start(['/bin/sh', '-c', cmd], option)
endfunction
然后,打开~/test,可以看到grep的结果
但是如果代码使用rubocop而不是grep,我看不到结果。
~/test文件为空
function hoge()
let cmd = 'rubocop'
let option = { 'exit_cb': function('s:aaa'),
\ 'out_io': 'file',
\ 'out_name': '~/test'}
call job_start(['/bin/sh', '-c', cmd], option)
endfunction
但是如果使用close\u cb
选项,我可以看到结果。
~/测试文件是rubocp编写的结果
function hoge()
let cmd = 'rubocop'
let option = { 'exit_cb': function('s:aaa'),
\ 'close_cb': function('s:bbb'),
\ 'out_io': 'file',
\ 'out_name': '~/test'}
call job_start(['/bin/sh', '-c', cmd], option)
endfunction
我不明白为什么会出现这些差异。
当需要
close\u cb
选项时?不熟悉ruby命令。很可能,要写入的数据是缓冲的,但不熟悉ruby命令。很可能要写入的数据已缓冲