diff --git a/autoload/dispatch.vim b/autoload/dispatch.vim index 2a18921..212e8d6 100644 --- a/autoload/dispatch.vim +++ b/autoload/dispatch.vim @@ -581,7 +581,11 @@ function! s:running(pid) abort if !a:pid return 0 elseif has('win32') - return system('tasklist /fi "pid eq '.a:pid.'"') =~# '===' + let tasklist_cmd = 'tasklist /fi "pid eq '.a:pid.'"' + if &shellxquote ==# '"' + let tasklist_cmd = substitute(tasklist_cmd, '"', "'", "g") + endif + return system(tasklist_cmd) =~# '===' else call system('kill -0 '.a:pid) return !v:shell_error diff --git a/autoload/dispatch/windows.vim b/autoload/dispatch/windows.vim index f571d3d..71fad90 100644 --- a/autoload/dispatch/windows.vim +++ b/autoload/dispatch/windows.vim @@ -71,9 +71,14 @@ function! dispatch#windows#start(request) abort endfunction function! dispatch#windows#activate(pid) abort - if system('tasklist /fi "pid eq '.a:pid.'"') !~# '===' + let tasklist_cmd = 'tasklist /fi "pid eq '.a:pid.'"' + if &shellxquote ==# '"' + let tasklist_cmd = substitute(tasklist_cmd, '"', "'", "g") + endif + if system(tasklist_cmd) !~# '===' return 0 endif + if !exists('s:activator') let s:activator = tempname().'.vbs' call writefile(['WScript.CreateObject("WScript.Shell").AppActivate(WScript.Arguments(0))'], s:activator)