Skip to content
Myr

Improve documentation of synchronous methods (#669)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by ehmicky · committed by GitHub · parent 65742c6 · Browse files · 2 files+36 added−40 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+36 added−40 removed

  • other:+36 added−40 removed

2 files+36 added−40 removed

modified:index.d.ts+19 added-20 removed
116 unmodified lines
117 - `'ipc'`: Sets an [IPC channel](https://nodejs.org/api/child_process.html#subprocesssendmessage-sendhandle-options-callback). You can also use `execaNode()` instead.118 - `'inherit'`: Re-use the current process' `stdin`.119 - an integer: Re-use a specific file descriptor from the current process.120 - a Node.js `Readable` stream.121 - a file path. If relative, it must start with `.`.122 - a file URL.123 - a web [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream).124 - an [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol) or an [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)125122 Unless the synchronous methods are used, the value can also be a:123 - file path. If relative, it must start with `.`.124 - file URL.125 - web [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream).126 - [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol) or [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)127126 This can be an [array of values](https://github.com/sindresorhus/execa#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.127128 @default `inherit` with `$`, `pipe` otherwise129 */
7 unmodified lines
137 - `'ipc'`: Sets an [IPC channel](https://nodejs.org/api/child_process.html#subprocesssendmessage-sendhandle-options-callback). You can also use `execaNode()` instead.138 - `'inherit'`: Re-use the current process' `stdout`.139 - an integer: Re-use a specific file descriptor from the current process.140 - a Node.js `Writable` stream.141 - a file path. If relative, it must start with `.`.142 - a file URL.143 - a web [`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream).144144 Unless the synchronous methods are used, the value can also be a:145 - file path. If relative, it must start with `.`.146 - file URL.147 - web [`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream).148145 This can be an [array of values](https://github.com/sindresorhus/execa#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.146147 @default 'pipe'148 */
7 unmodified lines
156 - `'ipc'`: Sets an [IPC channel](https://nodejs.org/api/child_process.html#subprocesssendmessage-sendhandle-options-callback). You can also use `execaNode()` instead.157 - `'inherit'`: Re-use the current process' `stderr`.158 - an integer: Re-use a specific file descriptor from the current process.159 - a Node.js `Writable` stream.160 - a file path. If relative, it must start with `.`.161 - a file URL.162 - a web [`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream).163165 Unless the synchronous methods are used, the value can also be a:166 - file path. If relative, it must start with `.`.167 - file URL.168 - web [`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream).169164 This can be an [array of values](https://github.com/sindresorhus/execa#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.165166 @default 'pipe'167 */
176 unmodified lines
344};345346export type Options<EncodingType extends EncodingOption = DefaultEncodingOption> = {347 /**354 Write some input to the child process' `stdin`.\355 Streams are not allowed when using the synchronous methods.348 Write some input to the child process' `stdin`.349350 See also the `inputFile` and `stdin` options.351 */352 readonly input?: string | Uint8Array | Readable;
132 unmodified lines
485 The output of the process with `stdout` and `stderr` interleaved.486487 This is `undefined` if either:488 - the `all` option is `false` (default value)496 - the synchronous methods are used489 - both `stdout` and `stderr` options are set to [`'inherit'`, `'ipc'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio)490 */491 all?: StdoutStderrType;492
58 unmodified lines
551 Stream combining/interleaving [`stdout`](https://nodejs.org/api/child_process.html#child_process_subprocess_stdout) and [`stderr`](https://nodejs.org/api/child_process.html#child_process_subprocess_stderr).552553 This is `undefined` if either:554 - the `all` option is `false` (the default value)563 - the synchronous methods are used555 - both `stdout` and `stderr` options are set to [`'inherit'`, `'ipc'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio)556 */557 all?: Readable;558
168 unmodified lines
727728/**729Same as `execa()` but synchronous.730731Cannot use the following options: `all`, `cleanup`, `buffer`, `detached`, `serialization` and `signal`. Also, the `stdin`, `stdout`, `stderr`, `stdio` and `input` options cannot be a stream nor an iterable.732733@param file - The program/script to execute, as a string or file URL734@param arguments - Arguments to pass to `file` on execution.735@returns A `childProcessResult` object736@throws A `childProcessResult` error
88 unmodified lines
825826/**827Same as `execaCommand()` but synchronous.828829Cannot use the following options: `all`, `cleanup`, `buffer`, `detached`, `serialization` and `signal`. Also, the `stdin`, `stdout`, `stderr`, `stdio` and `input` options cannot be a stream nor an iterable.830831@param command - The program/script to execute and its arguments.832@returns A `childProcessResult` object833@throws A `childProcessResult` error834
51 unmodified lines
886887 /**888 Same as $\`command\` but synchronous.889890 Cannot use the following options: `all`, `cleanup`, `buffer`, `detached`, `serialization` and `signal`. Also, the `stdin`, `stdout`, `stderr`, `stdio` and `input` options cannot be a stream nor an iterable.891892 @returns A `childProcessResult` object893 @throws A `childProcessResult` error894895 @example <caption>Basic</caption>
42 unmodified lines
938939 /**940 Same as $\`command\` but synchronous.941942 Cannot use the following options: `all`, `cleanup`, `buffer`, `detached`, `serialization` and `signal`. Also, the `stdin`, `stdout`, `stderr`, `stdio` and `input` options cannot be a stream nor an iterable.943944 @returns A `childProcessResult` object945 @throws A `childProcessResult` error946947 @example <caption>Basic</caption>
134 unmodified lines
modified:readme.md+17 added-20 removed
287 unmodified lines
288### execaSync(file, arguments?, options?)289290Same as [`execa()`](#execacommandcommand-options) but synchronous.291292Cannot use the following options: [`all`](#all-2), [`cleanup`](#cleanup), [`buffer`](#buffer), [`detached`](#detached), [`serialization`](#serialization) and [`signal`](#signal). Also, the [`stdin`](#stdin), [`stdout`](#stdout-1), [`stderr`](#stderr-1), [`stdio`](#stdio) and [`input`](#input) options cannot be a stream nor an iterable.293294Returns or throws a [`childProcessResult`](#childProcessResult).295296### $.sync\`command\`297### $.s\`command\`298299Same as [$\`command\`](#command) but synchronous.300301Cannot use the following options: [`all`](#all-2), [`cleanup`](#cleanup), [`buffer`](#buffer), [`detached`](#detached), [`serialization`](#serialization) and [`signal`](#signal). Also, the [`stdin`](#stdin), [`stdout`](#stdout-1), [`stderr`](#stderr-1), [`stdio`](#stdio) and [`input`](#input) options cannot be a stream nor an iterable.302303Returns or throws a [`childProcessResult`](#childProcessResult).304305### execaCommandSync(command, options?)306307Same as [`execaCommand()`](#execacommand-command-options) but synchronous.308309Cannot use the following options: [`all`](#all-2), [`cleanup`](#cleanup), [`buffer`](#buffer), [`detached`](#detached), [`serialization`](#serialization) and [`signal`](#signal). Also, the [`stdin`](#stdin), [`stdout`](#stdout-1), [`stderr`](#stderr-1), [`stdio`](#stdio) and [`input`](#input) options cannot be a stream nor an iterable.310311Returns or throws a [`childProcessResult`](#childProcessResult).312313### Shell syntax314
27 unmodified lines
342Stream [combining/interleaving](#ensuring-all-output-is-interleaved) [`stdout`](https://nodejs.org/api/child_process.html#child_process_subprocess_stdout) and [`stderr`](https://nodejs.org/api/child_process.html#child_process_subprocess_stderr).343344This is `undefined` if either:345- the [`all` option](#all-2) is `false` (the default value)340- the [synchronous methods](#execasyncfile-arguments-options) are used346- both [`stdout`](#stdout-1) and [`stderr`](#stderr-1) options are set to [`'inherit'`, `'ipc'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio)347348#### pipeStdout(target)349
77 unmodified lines
427The output of the process with `stdout` and `stderr` [interleaved](#ensuring-all-output-is-interleaved).428429This is `undefined` if either:430- the [`all` option](#all-2) is `false` (the default value)426- the [synchronous methods](#execasyncfile-arguments-options) are used431- both [`stdout`](#stdout-1) and [`stderr`](#stderr-1) options are set to [`'inherit'`, `'ipc'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio)432433#### failed434
122 unmodified lines
557#### input558559Type: `string | Uint8Array | stream.Readable`560557Write some input to the child process' `stdin`.\558Streams are not allowed when using the [synchronous methods](#execasyncfile-arguments-options).561Write some input to the child process' `stdin`.562563See also the [`inputFile`](#inputfile) and [`stdin`](#stdin) options.564565#### inputFile
16 unmodified lines
582- `'ipc'`: Sets an [IPC channel](https://nodejs.org/api/child_process.html#subprocesssendmessage-sendhandle-options-callback). You can also use [`execaNode()`](#execanodescriptpath-arguments-options) instead.583- `'inherit'`: Re-use the current process' `stdin`.584- an integer: Re-use a specific file descriptor from the current process.585- a [Node.js `Readable` stream](#redirect-a-nodejs-stream-fromto-stdinstdoutstderr).586- a file path. If relative, it must start with `.`.587- a file URL.588- a web [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream).589- an [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol) or an [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)590584Unless the [synchronous methods](#execasyncfile-arguments-options) are used, the value can also be a:585- file path. If relative, it must start with `.`.586- file URL.587- web [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream).588- [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol) or [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)589591This can be an [array of values](#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.592593#### stdout594
7 unmodified lines
602- `'ipc'`: Sets an [IPC channel](https://nodejs.org/api/child_process.html#subprocesssendmessage-sendhandle-options-callback). You can also use [`execaNode()`](#execanodescriptpath-arguments-options) instead.603- `'inherit'`: Re-use the current process' `stdout`.604- an integer: Re-use a specific file descriptor from the current process.605- a [Node.js `Writable` stream](#redirect-a-nodejs-stream-fromto-stdinstdoutstderr).606- a file path. If relative, it must start with `.`.607- a file URL.608- a web [`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream).609606Unless the [synchronous methods](#execasyncfile-arguments-options) are used, the value can also be a:607- file path. If relative, it must start with `.`.608- file URL.609- web [`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream).610610This can be an [array of values](#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.611612#### stderr613
7 unmodified lines
621- `'ipc'`: Sets an [IPC channel](https://nodejs.org/api/child_process.html#subprocesssendmessage-sendhandle-options-callback). You can also use [`execaNode()`](#execanodescriptpath-arguments-options) instead.622- `'inherit'`: Re-use the current process' `stderr`.623- an integer: Re-use a specific file descriptor from the current process.624- a [Node.js `Writable` stream](#redirect-a-nodejs-stream-fromto-stdinstdoutstderr).625- a file path. If relative, it must start with `.`.626- a file URL.627- a web [`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream).628627Unless the [synchronous methods](#execasyncfile-arguments-options) are used, the value can also be a:628- file path. If relative, it must start with `.`.629- file URL.630- web [`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream).631629This can be an [array of values](#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.630631#### stdio632
294 unmodified lines