Skip to content

Commit 2fbd0e1

Browse files
committed
System.AsyncProcess: Modified to not assume use of shell.
1 parent ab3b765 commit 2fbd0e1

2 files changed

Lines changed: 4 additions & 15 deletions

File tree

autoload/vital/__vital__/System/AsyncProcess.vim

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,6 @@ function! s:execute(command, options) abort
8383
throw 'vital: AsyncProcess: invalid argument (value type:' . type(a:command) . ')'
8484
endif
8585

86-
" build args
87-
let args = []
88-
if stridx(&shell, 'cmd.exe') != -1
89-
" cmd.exe
90-
let args = args + ['/c']
91-
else
92-
" sh, bash, pwsh, etc.
93-
let args = args + ['-c']
94-
endif
95-
let args = args + [command]
96-
9786
let job_id = -1
9887
if s:is_nvim
9988
let options = {}
@@ -107,7 +96,7 @@ function! s:execute(command, options) abort
10796
let options['on_exit'] = function('s:_inner_exit_cb', [a:options.exit_cb])
10897
endif
10998

110-
let job_id = jobstart([&shell] + args, options)
99+
let job_id = jobstart(command, options)
111100

112101
if has_key(a:options, 'timeout')
113102
if a:options.timeout > 0
@@ -130,7 +119,7 @@ function! s:execute(command, options) abort
130119
let options['exit_cb'] = function('s:_inner_exit_cb', [a:options.exit_cb])
131120
endif
132121

133-
let job = job_start([&shell] + args, options)
122+
let job = job_start(command, options)
134123

135124
if has_key(a:options, 'timeout')
136125
if a:options.timeout > 0

test/System/AsyncProcess.vimspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Describe System.AsyncProcess
4747
let g:exit_code = a:exit_code
4848
endfunction
4949

50-
let args = 'echo "abcdefg"'
50+
let args = 'cmd.exe /c echo "abcdefg"'
5151
call AsyncProcess.execute(args, {
5252
\ 'exit_cb': function('s:my_exit_cb'),
5353
\ 'out_cb': function('s:my_out_cb'),
@@ -60,7 +60,7 @@ Describe System.AsyncProcess
6060
Assert Equals(g:err_msg, "")
6161

6262
if s:is_windows
63-
let actual_out_msg = '\"abcdefg\"'
63+
let actual_out_msg = '"abcdefg"'
6464
else
6565
let actual_out_msg = "abcdefg"
6666
endif

0 commit comments

Comments
 (0)