1

I would like to set the working directory for the process started with job_start().

The only way I know how to do this is to change Vim's current working directory before calling job_start(), and then change it back to what it was. That is a little bit of a hack, and I am afraid it could cause problems for some people. Does anyone know a better way?

2

In Build-Tool-Wrapper, I've used sh -c to actually run cd compdir && make args:

" the a:cmd is managed elsewhere in the plugin
" it may contain many things, usually things like 
"    `cd build/dir && make tgt -j 8 2>&1 | gSTLfilt.pl`
if lh#os#OnDOSWindows() && &shell =~ 'cmd'
  let cmd = &shell . ' /C '.a:cmd
else
  let cmd = ['sh', '-c', a:cmd]
endif
let job = job_start(cmd,
      \ {
      \   'close_cb': ('CloseCB')
      \ , 'callback': ('CallbackCB')
      \ })

https://github.com/LucHermitte/vim-build-tools-wrapper/blob/job-compile/autoload/lh/btw/job_build.vim#L156

I haven't fully tested it yet on windows though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.