Skip to content

Commit da0b2af

Browse files
committed
System.AsyncProcess: Added System.AsyncProcess doc.
1 parent e0166e9 commit da0b2af

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

doc/vital/System/AsyncProcess.txt

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
*vital/System/AsyncProcess.txt* Cross platform async process executor
2+
3+
Maintainer: mikoto2000 <mikoto2000@gmail.com>
4+
5+
=============================================================================
6+
CONTENTS *Vital.System.AsyncProcess-contents*
7+
8+
Introduction |Vital.System.AsyncProcess-introduction|
9+
Usage |Vital.System.AsyncProcess-usage|
10+
Functions |Vital.System.AsyncProcess-functions|
11+
12+
13+
=============================================================================
14+
INTRODUCTION *Vital.System.AsyncProcess-introduction*
15+
16+
|Vital.System.AsyncProcess| provides a cross-platform functions to execute
17+
async process.
18+
19+
20+
=============================================================================
21+
USAGE *Vital.System.AsyncProcess-usage*
22+
>
23+
" call on exit callback
24+
function! s:my_exit_cb(exit_code) abort
25+
echomsg 'exit_cb status: ' .. a:exit_code
26+
endfunction
27+
28+
" call on out callback(called per line)
29+
function! s:my_out_cb(out_msg) abort
30+
echomsg 'out_cb_bytes: ' .. a:out_msg
31+
endfunction
32+
33+
" call on error callback(called per line)
34+
function! s:my_err_cb(err_msg) abort
35+
echomsg 'err_cb msg: ' .. a:err_msg
36+
endfunction
37+
38+
" execute async process
39+
call s:AsyncProcess.execute(
40+
\ 'ls /',
41+
\ {
42+
\ 'exit_cb': function('s:my_exit_cb'),
43+
\ 'out_cb': function('s:my_out_cb'),
44+
\ 'err_cb': function('s:my_err_cb'),
45+
\ }
46+
\)
47+
<
48+
49+
=============================================================================
50+
FUNCTIONS *Vital.System.AsyncProcess-functions*
51+
52+
*Vital.System.AsyncProcess.execute()*
53+
execute({args}[, {options}])
54+
Executes a async process specified by {args} (|List| or |String|).
55+
56+
The following attributes are supported in {options}
57+
58+
"exit_cb"
59+
A |function| of callback function called when the process exits.
60+
The callback function has one argument, exit_code(|Number|).
61+
62+
"out_cb"
63+
A |function| of callback function called when the process outputs
64+
some data. The callback function has one argument, out_msg(|String|).
65+
66+
"err_cb"
67+
A |function| of callback function called when the process outputs
68+
some error data. The callback function has one argument, err_msg(|String|).
69+
70+
71+
=============================================================================
72+
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl
73+

0 commit comments

Comments
 (0)