@@ -6,6 +6,8 @@ nvim-nio *nvim-nio*
66 nio....................................................................| nio |
77 nio.control....................................................| nio.control |
88 nio.lsp............................................................| nio.lsp |
9+ nio.process....................................................| nio.process |
10+ nio.streams....................................................| nio.streams |
911 nio.uv..............................................................| nio.uv |
1012 nio.ui..............................................................| nio.ui |
1113 nio.tests........................................................| nio.tests |
@@ -349,6 +351,108 @@ Return~
349351`(nio.lsp .Client)`
350352
351353
354+ ==============================================================================
355+ nio.process *nio.process*
356+
357+
358+ *nio.process.Process*
359+ Wrapper for a running process, providing access to its stdio streams and
360+ methods to interact with it.
361+
362+ Fields~
363+ {pid} `(integer)` ID of the invoked process
364+ {signal} `(fun(signal: integer|uv.aliases.signals))` Send a signal to
365+ the process
366+ {result} `(async fun(): number)` Wait for the process to exit and return the
367+ exit code
368+ {stdin} `(nio.streams.OSStreamWriter)` Stream to write to the process stdin.
369+ {stdout} `(nio.streams.OSStreamReader)` Stream to read from the process
370+ stdout.
371+ {stderr} `(nio.streams.OSStreamReader)` Stream to read from the process
372+ stderr.
373+
374+ *nio.process.run()*
375+ `run` ({opts} )
376+
377+ Run a process asynchronously.
378+ >lua
379+ local first = nio.process.run({
380+ cmd = "printf", args = { "hello" }
381+ })
382+
383+ local second = nio.process.run({
384+ cmd = "cat", stdin = first.stdout
385+ })
386+
387+ local output = second.stdout.read()
388+ print(output)
389+ <
390+ Parameters~
391+ {opts} `(nio.process.RunOpts)`
392+ Return~
393+ `(nio.process.Process)`
394+
395+ *nio.process.RunOpts*
396+ Fields~
397+ {cmd} `(string )` Command to run
398+ {args?} `(string [])` Arguments to pass to the command
399+ {stdin?} `(integer|nio.streams.OSStreamReader|uv.uv_pipe_t|uv_pipe_t)` Stream,
400+ pipe or file descriptor to use as stdin.
401+ {stdout?} `(integer|nio.streams.OSStreamWriter|uv.uv_pipe_t|uv_pipe_t)`
402+ Stream,
403+ pipe or file descriptor to use as stdout.
404+ {stderr?} `(integer|nio.streams.OSStreamWriter|uv.uv_pipe_t|uv_pipe_t)`
405+ Stream,
406+ pipe or file descriptor to use as stderr.
407+ {env?} `(table<string, string>)` Environment variables to pass to the
408+ process
409+ {cwd?} `(string )` Current working directory of the process
410+ {uid?} `(integer)` User ID of the process
411+ {gid?} `(integer)` Group ID of the process
412+
413+
414+ ==============================================================================
415+ nio.streams *nio.streams*
416+
417+
418+ *nio.streams.Stream*
419+ Fields~
420+ {close} `(async fun(): nil)` Close the stream
421+
422+ *nio.streams.Reader*
423+ Inherits: `nio.streams.Stream`
424+
425+ Fields~
426+ {read} `(async fun(n?: integer): string)` Read data from the stream,
427+ optionally up to n bytes otherwise until EOF is reached
428+
429+ *nio.streams.Writer*
430+ Inherits: `nio.streams.Stream`
431+
432+ Fields~
433+ {write} `(async fun(data: string): nil)` Write data to the stream
434+
435+ *nio.streams.OSStream*
436+ Inherits: `nio.streams.Stream`
437+
438+ Fields~
439+ {fd} `(integer)` The file descriptor of the stream
440+
441+ *nio.streams.StreamReader*
442+ Inherits: `nio.streams.Reader, nio.streams.Stream`
443+
444+ Inherits: `nio.streams.Writer, nio.streams.Stream`
445+ *nio.streams.StreamWriter*
446+
447+
448+ *nio.streams.OSStreamReader*
449+ Inherits: `nio.streams.StreamReader, nio.streams.OSStream`
450+
451+ Inherits: `nio.streams.StreamWriter, nio.streams.OSStream`
452+ *nio.streams.OSStreamWriter*
453+
454+
455+
352456==============================================================================
353457nio.uv *nio.uv*
354458
@@ -436,7 +540,8 @@ length: integer): (string|nil,integer|nil))`
436540{fs_scandir} `(async fun(path: string): (string| nil,uv_fs_t | nil))`
437541{shutdown} `(async fun(stream: uv_stream_t): string|nil)`
438542{listen} `(async fun(stream: uv_stream_t): string|nil)`
439- {write} `(async fun(stream: uv_stream_t): string|nil)`
543+ {write} `(async fun(stream: uv_stream_t, data: string|string[]):
544+ uv.uv_write_t|nil)`
440545{write2} `(async fun(stream: uv_stream_t, data: string|string[], send_handle:
441546uv_stream_t): string|nil)`
442547
0 commit comments