Skip to content

Commit f8faa98

Browse files
authored
Merge pull request #756 from tsuyoshicho/fix/vimproc-timeout-unit
2 parents 1b9fab5 + 1385f6e commit f8faa98

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

Changes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
8ebc53cf1ed6c53ee793e31611829fa57ae7c06d
2+
Modules: System.Process.Vimproc
3+
Documents as wrote seconds, but it was actually treated as milliseconds.
4+
Fix inner timeout unit, timeout set as seconds, call function as milliseconds at value x1000.
15
97e8cf8b230cd69720e130742859b51f5761196c
26
Modules: Web.HTTP
37
Added python3 to HTTP client, and refined its default value.

autoload/vital/__vital__/System/Process/Vimproc.vim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,13 @@ function! s:execute(args, options) abort
5151
" background process via Builtin always return exit_code:0 so mimic
5252
let status = 0
5353
else
54+
" System.Process.execute() {options} timeout unit as second.
55+
" convert to
56+
" vimproc#system {timeout} unit as millisecond.
5457
let output = vimproc#system(
5558
\ cmdline,
5659
\ s:Prelude.is_string(a:options.input) ? a:options.input : '',
57-
\ a:options.timeout,
60+
\ a:options.timeout * 1000,
5861
\)
5962
let status = vimproc#get_last_status()
6063
endif

test/System/Process/Vimproc.vimspec

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@ Describe System.Process.Vimproc
2929
" Not sure but 'sleep' doesn't properly works in AppVeyor?
3030
" The code below worked on Windows 10 + PowerShell
3131
It DOES NOT throws an exception when {options.timeout} is specified
32-
let options.timeout = 100
33-
let args = s:cmd + ['sleep', '10']
32+
" timeout 1 second = 1000 millisoconds
33+
let options.timeout = 1
34+
" sleep command 100 seconds wait
35+
let args = s:cmd + ['sleep', '100']
3436
let result = Process.execute(args, options)
3537
" While the execution time reachs the timeout, the success is 0.
3638
Assert Equals(result.success, 0)
37-
Assert Equals(result.status, 15)
39+
Assert Equals(result.status, 15)
3840
End
3941
endif
4042

@@ -157,8 +159,10 @@ Describe System.Process.Vimproc
157159
Context [Unix]
158160
Describe .execute({args}[, {options}])
159161
It DOES NOT throws an exception when {options.timeout} is specified
160-
let options.timeout = 100
161-
let args = ['sleep', '10']
162+
" timeout 1 second = 1000 millisoconds
163+
let options.timeout = 1
164+
" sleep command 100 seconds wait
165+
let args = ['sleep', '100']
162166
let result = Process.execute(args, options)
163167
" While the execution time reachs the timeout, the success is 0.
164168
Assert Equals(result.success, 0)

0 commit comments

Comments
 (0)