Skip to content
Myr

Improve `maxBuffer` option with `execaSync()` (#960)

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

authored by ehmicky · committed by GitHub · parent bdda475 · Browse files · 8 files+171 added−71 removed
This commit

State

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

Diff stats

8 files+171 added−71 removed

  • tests:+115 added−50 removed
  • other:+56 added−21 removed

8 files+171 added−71 removed

modified:lib/exit/code.js+9 added-6 removed
modified:lib/stdio/output-sync.js+9 added-4 removed
modified:lib/sync.js+5 added-5 removed
53 unmodified lines
54 if (syncResult.failed) {55 return syncResult;56 }5758 const {resultError, exitCode, signal} = getSyncExitResult(syncResult);59 const {output, error = resultError} = transformOutputSync(fileDescriptors, syncResult, options);58 const {resultError, exitCode, signal, timedOut, isMaxBuffer} = getSyncExitResult(syncResult, options);59 const {output, error = resultError} = transformOutputSync({fileDescriptors, syncResult, options, isMaxBuffer});60 const stdio = output.map(stdioOutput => stripNewline(stdioOutput, options));61 const all = stripNewline(getAllSync(output, options), options);62 return getSyncResult({error, exitCode, signal, stdio, all, options, command, escapedCommand, startTime});62 return getSyncResult({error, exitCode, signal, timedOut, stdio, all, options, command, escapedCommand, startTime});63};6465const runSubprocessSync = ({file, args, options, command, escapedCommand, fileDescriptors, startTime}) => {66 try {
6 unmodified lines
73};7475const normalizeSpawnSyncOptions = ({encoding, ...options}) => ({...options, encoding: 'buffer'});7677const getSyncResult = ({error, exitCode, signal, stdio, all, options, command, escapedCommand, startTime}) => error === undefined77const getSyncResult = ({error, exitCode, signal, timedOut, stdio, all, options, command, escapedCommand, startTime}) => error === undefined78 ? makeSuccessResult({command, escapedCommand, stdio, all, options, startTime})79 : makeError({80 error,81 command,82 escapedCommand,83 timedOut: error.code === 'ETIMEDOUT',83 timedOut,84 isCanceled: false,85 exitCode,86 signal,87 stdio,
5 unmodified lines
modified:test/stdio/lines.js+12 added
135 unmodified lines
136 t.true(cause instanceof MaxBufferError);137 t.deepEqual(stdout, noNewlinesChunks.slice(0, maxBuffer));138});139140test('"maxBuffer" is measured in lines with "lines: true"', async t => {141 const {stdout} = await t.throwsAsync(execa('noop-repeat.js', ['1', '...\n'], {lines: true, maxBuffer: 2}));142 t.deepEqual(stdout, ['...', '...']);143});144145test('"maxBuffer" is measured in bytes with "lines: true", sync', t => {146 const {stdout} = t.throws(() => {147 execaSync('noop-repeat.js', ['1', '...\n'], {lines: true, maxBuffer: 2});148 }, {code: 'ENOBUFS'});149 t.deepEqual(stdout, ['..']);150});151152test('"lines: true" stops on stream error', async t => {153 const cause = new Error(foobarString);154 const error = await t.throwsAsync(getSimpleChunkSubprocessAsync({155 * stdout(line) {
67 unmodified lines
modified:test/stdio/transform.js+27 added-3 removed
151 unmodified lines
152 stdout: generatorsMap[type].getOutput(bigString)(false, true),153 });154 t.is(stdout, bigString);155156 await t.throwsAsync(execa('noop.js', {maxBuffer, stdout: generatorsMap[type].getOutput(`${bigString}.`)(false)}));156 await t.throwsAsync(execa('noop.js', {157 maxBuffer,158 stdout: generatorsMap[type].getOutput(`${bigString}.`)(false, true),159 }));160};161162test('Generators take "maxBuffer" into account', testMaxBuffer, 'generator');163test('Duplexes take "maxBuffer" into account', testMaxBuffer, 'duplex');164test('WebTransforms take "maxBuffer" into account', testMaxBuffer, 'webTransform');165166test('Generators does not take "maxBuffer" into account, sync', t => {167 const bigString = '.'.repeat(maxBuffer);168 const {stdout} = execaSync('noop.js', {169 maxBuffer,170 stdout: generatorsMap.generator.getOutput(`${bigString}.`)(false, true),171 });172 t.is(stdout.length, maxBuffer + 1);173});174175const testMaxBufferObject = async (t, type) => {164 const bigArray = Array.from({length: maxBuffer}).fill('.');176 const bigArray = Array.from({length: maxBuffer}).fill('..');177 const {stdout} = await execa('noop.js', {178 maxBuffer,179 stdout: generatorsMap[type].getOutputs(bigArray)(true, true),180 });181 t.is(stdout.length, maxBuffer);182171 await t.throwsAsync(execa('noop.js', {maxBuffer, stdout: generatorsMap[type].getOutputs([...bigArray, ''])(true)}));183 await t.throwsAsync(execa('noop.js', {184 maxBuffer,185 stdout: generatorsMap[type].getOutputs([...bigArray, ''])(true, true),186 }));187};188189test('Generators take "maxBuffer" into account, objectMode', testMaxBufferObject, 'generator');190test('Duplexes take "maxBuffer" into account, objectMode', testMaxBufferObject, 'duplex');191test('WebTransforms take "maxBuffer" into account, objectMode', testMaxBufferObject, 'webTransform');192193test('Generators does not take "maxBuffer" into account, objectMode, sync', t => {194 const bigArray = Array.from({length: maxBuffer}).fill('..');195 const {stdout} = execaSync('noop.js', {196 maxBuffer,197 stdout: generatorsMap.generator.getOutputs([...bigArray, ''])(true, true),198 });199 t.is(stdout.length, maxBuffer + 1);200});201202const testAsyncGenerators = async (t, type, final) => {203 const {stdout} = await execa('noop.js', {204 stdout: convertTransformToFinal(generatorsMap[type].timeout(1e2)(), final),205 });
87 unmodified lines
modified:test/stream/max-buffer.js+76 added-47 removed
8 unmodified lines
910const maxBuffer = 10;11const maxBufferMessage = /maxBuffer exceeded/;1213const runMaxBuffer = (t, execaMethod, fdNumber, options) => execaMethod === execa14 ? t.throwsAsync(getMaxBufferSubprocess(execaMethod, fdNumber, options), {message: maxBufferMessage})15 : t.throws(() => {16 getMaxBufferSubprocess(execaMethod, fdNumber, options);17 }, {code: 'ENOBUFS'});1819const getMaxBufferSubprocess = (execaMethod, fdNumber, {length = maxBuffer, ...options} = {}) =>20 execaMethod('max-buffer.js', [`${fdNumber}`, `${length + 1}`], {...fullStdio, maxBuffer, ...options});2122const getExpectedOutput = (length = maxBuffer) => '.'.repeat(length);2324const testMaxBufferSuccess = async (t, fdNumber, all) => {14 await t.notThrowsAsync(execa('max-buffer.js', [`${fdNumber}`, `${maxBuffer}`], {...fullStdio, maxBuffer, all}));25 await t.notThrowsAsync(getMaxBufferSubprocess(execa, fdNumber, {all, length: maxBuffer - 1}));26};2728test('maxBuffer does not affect stdout if too high', testMaxBufferSuccess, 1, false);29test('maxBuffer does not affect stderr if too high', testMaxBufferSuccess, 2, false);30test('maxBuffer does not affect stdio[*] if too high', testMaxBufferSuccess, 3, false);31test('maxBuffer does not affect all if too high', testMaxBufferSuccess, 1, true);3233const testMaxBufferSuccessSync = (t, fdNumber, all) => {34 t.notThrows(() => {35 getMaxBufferSubprocess(execaSync, fdNumber, {all, length: maxBuffer - 1});36 });37};3839test('maxBuffer does not affect stdout if too high, sync', testMaxBufferSuccessSync, 1, false);40test('maxBuffer does not affect stderr if too high, sync', testMaxBufferSuccessSync, 2, false);41test('maxBuffer does not affect stdio[*] if too high, sync', testMaxBufferSuccessSync, 3, false);42test('maxBuffer does not affect all if too high, sync', testMaxBufferSuccessSync, 1, true);4344const testGracefulExit = async (t, fixtureName, expectedExitCode) => {45 const {exitCode, signal, stdout} = await t.throwsAsync(46 execa(fixtureName, ['1', '.'.repeat(maxBuffer + 1)], {maxBuffer}),47 {message: maxBufferMessage},48 );49 t.is(exitCode, expectedExitCode);50 t.is(signal, undefined);29 t.is(stdout, '.'.repeat(maxBuffer));51 t.is(stdout, getExpectedOutput());52};5354test('maxBuffer terminates stream gracefully, more writes', testGracefulExit, 'noop-repeat.js', 1);55test('maxBuffer terminates stream gracefully, no more writes', testGracefulExit, 'noop-fd.js', 0);5635const testMaxBufferLimit = async (t, fdNumber, all) => {36 const length = all ? maxBuffer * 2 : maxBuffer;37 const result = await t.throwsAsync(38 execa('max-buffer.js', [`${fdNumber}`, `${length + 1}`], {...fullStdio, maxBuffer, all}),39 {message: maxBufferMessage},40 );41 t.is(all ? result.all : result.stdio[fdNumber], '.'.repeat(length));57const testGracefulExitSync = (t, fixtureName) => {58 const {exitCode, signal, stdout} = t.throws(() => {59 execaSync(fixtureName, ['1', '.'.repeat(maxBuffer + 1)], {maxBuffer, killSignal: 'SIGINT'});60 }, {code: 'ENOBUFS'});61 t.is(exitCode, undefined);62 t.is(signal, 'SIGINT');63 t.is(stdout, getExpectedOutput());64};6544test('maxBuffer affects stdout', testMaxBufferLimit, 1, false);45test('maxBuffer affects stderr', testMaxBufferLimit, 2, false);46test('maxBuffer affects stdio[*]', testMaxBufferLimit, 3, false);47test('maxBuffer affects all', testMaxBufferLimit, 1, true);66test('maxBuffer terminate stream with killSignal, more writes, sync', testGracefulExitSync, 'noop-repeat.js');67test('maxBuffer terminate stream with killSignal, no more writes, sync', testGracefulExitSync, 'noop-fd.js');6849const testMaxBufferEncoding = async (t, fdNumber) => {50 const result = await t.throwsAsync(51 execa('max-buffer.js', [`${fdNumber}`, `${maxBuffer + 1}`], {...fullStdio, maxBuffer, encoding: 'buffer'}),52 );69const testMaxBufferLimit = async (t, execaMethod, fdNumber, all) => {70 const length = all && execaMethod === execa ? maxBuffer * 2 : maxBuffer;71 const result = await runMaxBuffer(t, execaMethod, fdNumber, {all, length});72 t.is(all ? result.all : result.stdio[fdNumber], getExpectedOutput(length));73};7475test('maxBuffer truncates stdout', testMaxBufferLimit, execa, 1, false);76test('maxBuffer truncates stderr', testMaxBufferLimit, execa, 2, false);77test('maxBuffer truncates stdio[*]', testMaxBufferLimit, execa, 3, false);78test('maxBuffer truncates all', testMaxBufferLimit, execa, 1, true);79test('maxBuffer truncates stdout, sync', testMaxBufferLimit, execaSync, 1, false);80test('maxBuffer truncates stderr, sync', testMaxBufferLimit, execaSync, 2, false);81test('maxBuffer truncates stdio[*], sync', testMaxBufferLimit, execaSync, 3, false);82test('maxBuffer truncates all, sync', testMaxBufferLimit, execaSync, 1, true);8384const testMaxBufferEncoding = async (t, execaMethod, fdNumber) => {85 const result = await runMaxBuffer(t, execaMethod, fdNumber, {encoding: 'buffer'});86 const stream = result.stdio[fdNumber];87 t.true(stream instanceof Uint8Array);55 t.is(Buffer.from(stream).toString(), '.'.repeat(maxBuffer));88 t.is(Buffer.from(stream).toString(), getExpectedOutput());89};9058test('maxBuffer works with encoding buffer and stdout', testMaxBufferEncoding, 1);59test('maxBuffer works with encoding buffer and stderr', testMaxBufferEncoding, 2);60test('maxBuffer works with encoding buffer and stdio[*]', testMaxBufferEncoding, 3);91test('maxBuffer works with encoding buffer and stdout', testMaxBufferEncoding, execa, 1);92test('maxBuffer works with encoding buffer and stderr', testMaxBufferEncoding, execa, 2);93test('maxBuffer works with encoding buffer and stdio[*]', testMaxBufferEncoding, execa, 3);94test('maxBuffer works with encoding buffer and stdout, sync', testMaxBufferEncoding, execaSync, 1);95test('maxBuffer works with encoding buffer and stderr, sync', testMaxBufferEncoding, execaSync, 2);96test('maxBuffer works with encoding buffer and stdio[*], sync', testMaxBufferEncoding, execaSync, 3);9798const testMaxBufferHex = async (t, fdNumber) => {63 const halfMaxBuffer = maxBuffer / 2;64 const {stdio} = await t.throwsAsync(65 execa('max-buffer.js', [`${fdNumber}`, `${halfMaxBuffer + 1}`], {...fullStdio, maxBuffer, encoding: 'hex'}),66 );67 t.is(stdio[fdNumber], Buffer.from('.'.repeat(halfMaxBuffer)).toString('hex'));99 const length = maxBuffer / 2;100 const {stdio} = await runMaxBuffer(t, execa, fdNumber, {length, encoding: 'hex'});101 t.is(stdio[fdNumber], Buffer.from(getExpectedOutput(length)).toString('hex'));102};103104test('maxBuffer works with other encodings and stdout', testMaxBufferHex, 1);105test('maxBuffer works with other encodings and stderr', testMaxBufferHex, 2);106test('maxBuffer works with other encodings and stdio[*]', testMaxBufferHex, 3);107108const testMaxBufferHexSync = async (t, fdNumber) => {109 const length = maxBuffer / 2;110 const {stdio} = await getMaxBufferSubprocess(execaSync, fdNumber, {length, encoding: 'hex'});111 t.is(stdio[fdNumber], Buffer.from(getExpectedOutput(length + 1)).toString('hex'));112};113114test('maxBuffer ignores other encodings and stdout, sync', testMaxBufferHexSync, 1);115test('maxBuffer ignores other encodings and stderr, sync', testMaxBufferHexSync, 2);116test('maxBuffer ignores other encodings and stdio[*], sync', testMaxBufferHexSync, 3);117118const testNoMaxBuffer = async (t, fdNumber) => {75 const subprocess = execa('max-buffer.js', [`${fdNumber}`, `${maxBuffer}`], {...fullStdio, buffer: false});76 const [result, output] = await Promise.all([119 const subprocess = getMaxBufferSubprocess(execa, fdNumber, {buffer: false});120 const [{stdio}, output] = await Promise.all([121 subprocess,122 getStream(subprocess.stdio[fdNumber]),123 ]);80 t.is(result.stdio[fdNumber], undefined);81 t.is(output, '.'.repeat(maxBuffer));124 t.is(stdio[fdNumber], undefined);125 t.is(output, getExpectedOutput(maxBuffer + 1));126};127128test('do not buffer stdout when `buffer` set to `false`', testNoMaxBuffer, 1);129test('do not buffer stderr when `buffer` set to `false`', testNoMaxBuffer, 2);130test('do not buffer stdio[*] when `buffer` set to `false`', testNoMaxBuffer, 3);131132const testNoMaxBufferSync = (t, fdNumber) => {89 const {stdio} = execaSync('max-buffer.js', [`${fdNumber}`, `${maxBuffer}`], {...fullStdio, buffer: false});133 const {stdio} = getMaxBufferSubprocess(execaSync, fdNumber, {buffer: false});134 t.is(stdio[fdNumber], undefined);135};136137// @todo: add a test for fd3 once the following Node.js bug is fixed.138// https://github.com/nodejs/node/issues/52338139test('do not buffer stdout when `buffer` set to `false`, sync', testNoMaxBufferSync, 1);140test('do not buffer stderr when `buffer` set to `false`, sync', testNoMaxBufferSync, 2);14198const testNoMaxBufferOption = async (t, fdNumber) => {99 const length = maxBuffer + 1;100 const subprocess = execa('max-buffer.js', [`${fdNumber}`, `${length}`], {...fullStdio, maxBuffer, buffer: false});101 const [result, output] = await Promise.all([102 subprocess,103 getStream(subprocess.stdio[fdNumber]),104 ]);105 t.is(result.stdio[fdNumber], undefined);106 t.is(output, '.'.repeat(length));107};108109test('do not hit maxBuffer when `buffer` is `false` with stdout', testNoMaxBufferOption, 1);110test('do not hit maxBuffer when `buffer` is `false` with stderr', testNoMaxBufferOption, 2);111test('do not hit maxBuffer when `buffer` is `false` with stdio[*]', testNoMaxBufferOption, 3);112142const testMaxBufferAbort = async (t, fdNumber) => {114 const subprocess = execa('max-buffer.js', [`${fdNumber}`, `${maxBuffer + 1}`], {...fullStdio, maxBuffer});143 const subprocess = getMaxBufferSubprocess(execa, fdNumber);144 await Promise.all([145 t.throwsAsync(subprocess, {message: maxBufferMessage}),146 t.throwsAsync(getStream(subprocess.stdio[fdNumber]), {code: 'ERR_STREAM_PREMATURE_CLOSE'}),147 ]);
5 unmodified lines
modified:index.d.ts+22 added-4 removed
1415 unmodified lines
14161417/**1418Same as `execa()` but synchronous.14191420Returns or throws a `subprocessResult`. The `subprocess` is not returned: its methods and properties are not available. This includes [`.kill()`](https://nodejs.org/api/child_process.html#subprocesskillsignal), [`.pid`](https://nodejs.org/api/child_process.html#subprocesspid), `.pipe()`, `.iterable()`, `.readable()`, `.writable()`, `.duplex()` and the [`.stdin`/`.stdout`/`.stderr`](https://nodejs.org/api/child_process.html#subprocessstdout) streams.1420Returns or throws a `subprocessResult`. The `subprocess` is not returned: its methods and properties are not available.14211422Cannot use the following options: `cleanup`, `detached`, `ipc`, `serialization`, `cancelSignal` and `forceKillAfterDelay`. `result.all` is not interleaved. Also, the `stdin`, `stdout`, `stderr` and `stdio` options cannot be [`'overlapped'`](https://nodejs.org/api/child_process.html#optionsstdio), an async iterable, an async transform, a `Duplex`, or a web stream. Node.js streams must have a file descriptor unless the `input` option is used.1422The following features cannot be used:1423- Streams: [`subprocess.stdin`](https://nodejs.org/api/child_process.html#subprocessstdin), [`subprocess.stdout`](https://nodejs.org/api/child_process.html#subprocessstdout), [`subprocess.stderr`](https://nodejs.org/api/child_process.html#subprocessstderr), `subprocess.readable()`, `subprocess.writable()`, `subprocess.duplex()`.1424- The `stdin`, `stdout`, `stderr` and `stdio` options cannot be [`'overlapped'`](https://nodejs.org/api/child_process.html#optionsstdio), an async iterable, an async transform, a `Duplex`, nor a web stream. Node.js streams can be passed but only if either they [have a file descriptor](#redirect-a-nodejs-stream-fromto-stdinstdoutstderr), or the `input` option is used.1425- Signal termination: [`subprocess.kill()`](https://nodejs.org/api/child_process.html#subprocesskillsignal), [`subprocess.pid`](https://nodejs.org/api/child_process.html#subprocesspid), `cleanup` option, `cancelSignal` option, `forceKillAfterDelay` option.1426- Piping multiple processes: `subprocess.pipe()`.1427- `subprocess.iterable()`.1428- `ipc` and `serialization` options.1429- `result.all` is not interleaved.1430- `detached` option.1431- The `maxBuffer` option is always measured in bytes, not in characters, lines nor objects. Also, it ignores transforms and the `encoding` option.14321433@param file - The program/script to execute, as a string or file URL1434@param arguments - Arguments to pass to `file` on execution.1435@returns A `subprocessResult` object
103 unmodified lines
15391540/**1541Same as `execaCommand()` but synchronous.15421534Returns or throws a `subprocessResult`. The `subprocess` is not returned: its methods and properties are not available. This includes [`.kill()`](https://nodejs.org/api/child_process.html#subprocesskillsignal), [`.pid`](https://nodejs.org/api/child_process.html#subprocesspid), `.pipe()`, `.iterable()`, `.readable()`, `.writable()`, `.duplex()` and the [`.stdin`/`.stdout`/`.stderr`](https://nodejs.org/api/child_process.html#subprocessstdout) streams.1543Returns or throws a `subprocessResult`. The `subprocess` is not returned: its methods and properties are not available.15441536Cannot use the following options: `cleanup`, `detached`, `ipc`, `serialization`, `cancelSignal` and `forceKillAfterDelay`. `result.all` is not interleaved. Also, the `stdin`, `stdout`, `stderr` and `stdio` options cannot be [`'overlapped'`](https://nodejs.org/api/child_process.html#optionsstdio), an async iterable, an async transform, a `Duplex`, or a web stream. Node.js streams must have a file descriptor unless the `input` option is used.1545The following features cannot be used:1546- Streams: [`subprocess.stdin`](https://nodejs.org/api/child_process.html#subprocessstdin), [`subprocess.stdout`](https://nodejs.org/api/child_process.html#subprocessstdout), [`subprocess.stderr`](https://nodejs.org/api/child_process.html#subprocessstderr), `subprocess.readable()`, `subprocess.writable()`, `subprocess.duplex()`.1547- The `stdin`, `stdout`, `stderr` and `stdio` options cannot be [`'overlapped'`](https://nodejs.org/api/child_process.html#optionsstdio), an async iterable, an async transform, a `Duplex`, nor a web stream. Node.js streams can be passed but only if either they [have a file descriptor](#redirect-a-nodejs-stream-fromto-stdinstdoutstderr), or the `input` option is used.1548- Signal termination: [`subprocess.kill()`](https://nodejs.org/api/child_process.html#subprocesskillsignal), [`subprocess.pid`](https://nodejs.org/api/child_process.html#subprocesspid), `cleanup` option, `cancelSignal` option, `forceKillAfterDelay` option.1549- Piping multiple processes: `subprocess.pipe()`.1550- `subprocess.iterable()`.1551- `ipc` and `serialization` options.1552- `result.all` is not interleaved.1553- `detached` option.1554- The `maxBuffer` option is always measured in bytes, not in characters, lines nor objects. Also, it ignores transforms and the `encoding` option.15551556@param command - The program/script to execute and its arguments.1557@returns A `subprocessResult` object1558@throws A `subprocessResult` error
128 unmodified lines
modified:readme.md+11 added-2 removed
315 unmodified lines
316#### execaSync\`command\`317318Same as [`execa()`](#execafile-arguments-options) but synchronous.319320Returns or throws a [`subprocessResult`](#subprocessResult). The [`subprocess`](#subprocess) is not returned: its methods and properties are not available. This includes [`.kill()`](https://nodejs.org/api/child_process.html#subprocesskillsignal), [`.pid`](https://nodejs.org/api/child_process.html#subprocesspid), [`.pipe()`](#pipefile-arguments-options), [`.iterable()`](#iterablereadableoptions), [`.readable()`](#readablereadableoptions), [`.writable()`](#writablewritableoptions), [`.duplex()`](#duplexduplexoptions) and the [`.stdin`/`.stdout`/`.stderr`](https://nodejs.org/api/child_process.html#subprocessstdout) streams.320Returns or throws a [`subprocessResult`](#subprocessResult). The [`subprocess`](#subprocess) is not returned: its methods and properties are not available.321322Cannot use the following options: [`cleanup`](#cleanup), [`detached`](#detached), [`ipc`](#ipc), [`serialization`](#serialization), [`cancelSignal`](#cancelsignal) and [`forceKillAfterDelay`](#forcekillafterdelay). [`result.all`](#all-1) is not interleaved. Also, the [`stdin`](#stdin), [`stdout`](#stdout-1), [`stderr`](#stderr-1) and [`stdio`](#stdio-1) options cannot be [`'overlapped'`](https://nodejs.org/api/child_process.html#optionsstdio), an async iterable, an async [transform](docs/transform.md), a [`Duplex`](docs/transform.md#duplextransform-streams), or a web stream. Node.js streams [must have a file descriptor](#redirect-a-nodejs-stream-fromto-stdinstdoutstderr) unless the `input` option is used.322The following features cannot be used:323- Streams: [`subprocess.stdin`](https://nodejs.org/api/child_process.html#subprocessstdin), [`subprocess.stdout`](https://nodejs.org/api/child_process.html#subprocessstdout), [`subprocess.stderr`](https://nodejs.org/api/child_process.html#subprocessstderr), [`subprocess.readable()`](#readablereadableoptions), [`subprocess.writable()`](#writablewritableoptions), [`subprocess.duplex()`](#duplexduplexoptions).324- The [`stdin`](#stdin), [`stdout`](#stdout-1), [`stderr`](#stderr-1) and [`stdio`](#stdio-1) options cannot be [`'overlapped'`](https://nodejs.org/api/child_process.html#optionsstdio), an async iterable, an async [transform](docs/transform.md), a [`Duplex`](docs/transform.md#duplextransform-streams), nor a web stream. Node.js streams can be passed but only if either they [have a file descriptor](#redirect-a-nodejs-stream-fromto-stdinstdoutstderr), or the `input` option is used.325- Signal termination: [`subprocess.kill()`](https://nodejs.org/api/child_process.html#subprocesskillsignal), [`subprocess.pid`](https://nodejs.org/api/child_process.html#subprocesspid), [`cleanup`](#cleanup) option, [`cancelSignal`](#cancelsignal) option, [`forceKillAfterDelay`](#forcekillafterdelay) option.326- Piping multiple processes: [`subprocess.pipe()`](#pipefile-arguments-options).327- [`subprocess.iterable()`](#iterablereadableoptions).328- [`ipc`](#ipc) and [`serialization`](#serialization) options.329- [`result.all`](#all-1) is not interleaved.330- [`detached`](#detached) option.331- The [`maxBuffer`](#maxbuffer) option is always measured in bytes, not in characters, [lines](#lines) nor [objects](docs/transform.md#object-mode). Also, it ignores transforms and the [`encoding`](#encoding) option.332333#### $(file, arguments?, options?)334335`file`: `string | URL`\
899 unmodified lines