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
Provenance
- Commit
b11cbcd- Tree
33531ac- Author
ehmicky <ehmicky@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
65742c6
2 files changed+36 added−40 removed
modified:index.d.ts+19 added-20 removed
116 unmodified lines117 - `'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)125 122- 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)127-126 This can be an [array of values](https://github.com/sindresorhus/execa#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.127 128 @default `inherit` with `$`, `pipe` otherwise129 */7 unmodified lines137 - `'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).144 144- 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).148-145 This can be an [array of values](https://github.com/sindresorhus/execa#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.146 147 @default 'pipe'148 */7 unmodified lines156 - `'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).163 165- 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).169-164 This can be an [array of values](https://github.com/sindresorhus/execa#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.165 166 @default 'pipe'167 */176 unmodified lines344 };345 346 export 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`.349 350 See also the `inputFile` and `stdin` options.351 */352 readonly input?: string | Uint8Array | Readable;132 unmodified lines485 The output of the process with `stdout` and `stderr` interleaved.486 487 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 lines551 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).552 553 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 lines727 728 /**729 Same as `execa()` but synchronous.730 731+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.732+733 @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` error88 unmodified lines825 826 /**827 Same as `execaCommand()` but synchronous.828 829+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.830+831 @param command - The program/script to execute and its arguments.832 @returns A `childProcessResult` object833 @throws A `childProcessResult` error834 51 unmodified lines886 887 /**888 Same as $\`command\` but synchronous.889 890+ 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.891+892 @returns A `childProcessResult` object893 @throws A `childProcessResult` error894 895 @example <caption>Basic</caption>42 unmodified lines938 939 /**940 Same as $\`command\` but synchronous.941 942+ 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.943+944 @returns A `childProcessResult` object945 @throws A `childProcessResult` error946 947 @example <caption>Basic</caption>134 unmodified linesmodified:readme.md+17 added-20 removed
287 unmodified lines288 ### execaSync(file, arguments?, options?)289 290 Same as [`execa()`](#execacommandcommand-options) but synchronous.291 292+Cannot 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.293+294 Returns or throws a [`childProcessResult`](#childProcessResult).295 296 ### $.sync\`command\`297 ### $.s\`command\`298 299 Same as [$\`command\`](#command) but synchronous.300 301+Cannot 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.302+303 Returns or throws a [`childProcessResult`](#childProcessResult).304 305 ### execaCommandSync(command, options?)306 307 Same as [`execaCommand()`](#execacommand-command-options) but synchronous.308 309+Cannot 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.310+311 Returns or throws a [`childProcessResult`](#childProcessResult).312 313 ### Shell syntax314 27 unmodified lines342 Stream [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).343 344 This 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)347 348 #### pipeStdout(target)349 77 unmodified lines427 The output of the process with `stdout` and `stderr` [interleaved](#ensuring-all-output-is-interleaved).428 429 This 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)432 433 #### failed434 122 unmodified lines557 #### input558 559 Type: `string | Uint8Array | stream.Readable`560 557-Write some input to the child process' `stdin`.\558-Streams are not allowed when using the [synchronous methods](#execasyncfile-arguments-options).561+Write some input to the child process' `stdin`.562 563 See also the [`inputFile`](#inputfile) and [`stdin`](#stdin) options.564 565 #### inputFile16 unmodified lines582 - `'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)590 584-Unless 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)589-591 This can be an [array of values](#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.592 593 #### stdout594 7 unmodified lines602 - `'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).609 606-Unless 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).610-610 This can be an [array of values](#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.611 612 #### stderr613 7 unmodified lines621 - `'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).628 627-Unless 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).631-629 This can be an [array of values](#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.630 631 #### stdio632 294 unmodified lines