diff --git a/docs/input.md b/docs/input.md index 5d24c3f209..6d6c7bb296 100644 --- a/docs/input.md +++ b/docs/input.md @@ -112,6 +112,18 @@ import {getOneMessage} from 'execa'; const ipcInput = await getOneMessage(); ``` +## Multiple inputs + +The input can come from multiple sources by setting the [`stdin`](api.md#optionsstdin) option to an array of values. Alternatively the [`input`](api.md#optionsinput), [`inputFile`](api.md#optionsinputfile) and [`stdin`](api.md#optionsstdin) options can be combined. + +The following example redirects `stdin` from both the [terminal](#terminal-input) and an `input.txt` [file](#file-input). + +```js +await execa({stdin: ['inherit', {file: 'input.txt'}]})`npm run scaffold`; +``` + +__Loss of TTY control:__ Please note that when a file descriptor is configured with a combination of `'inherit'` and other values, this file descriptor will never refer to a TTY in the subprocess, even if in the current process it does. + ## Additional file descriptors The [`stdio`](api.md#optionsstdio) option can be used to pass some input to any [file descriptor](https://en.wikipedia.org/wiki/File_descriptor), as opposed to only [`stdin`](api.md#optionsstdin). diff --git a/docs/output.md b/docs/output.md index f840895e29..b2dbb505a5 100644 --- a/docs/output.md +++ b/docs/output.md @@ -86,7 +86,7 @@ await sendMessage({kind: 'stop', timestamp: new Date()}); ## Multiple targets -The output can be redirected to multiple targets by setting the [`stdout`](api.md#optionsstdout) or [`stderr`](api.md#optionsstderr) option to an array of values. This also allows specifying multiple inputs with the [`stdin`](api.md#optionsstdin) option. +The output can be redirected to multiple targets by setting the [`stdout`](api.md#optionsstdout) or [`stderr`](api.md#optionsstderr) option to an array of values. The following example redirects `stdout` to both the [terminal](#terminal-output) and an `output.txt` [file](#file-output), while also retrieving its value [programmatically](#stdout-and-stderr).