You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f6de9be
Browse filesBrowse the repository at this point in the historyBrowse files
Fix subprocesses hanging after exceeding maxBuffer
Closing the output stream does not stop a subprocess that stays alive without writing again, so Execa's promise never settled. The subprocess is now terminated with the `killSignal` option when the limit is exceeded, like with synchronous methods and the other termination options. The error reports the real exit of the subprocess, which might have exited on its own before being terminated.
Copy file name to clipboardExpand all lines: docs/api.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1035,7 +1035,7 @@ By default, this applies to both `stdout` and `stderr`, but [different values ca
1035
1035
1036
1036
With [synchronous methods](execution.md#synchronous-execution), this cannot be enforced per file descriptor while the subprocess runs, since `spawnSync()` only accepts a single value, which limits the total output of all file descriptors. The `maxBuffer.stdout` value is used for it. The other file descriptors' own values are enforced from the output, once the subprocess ended, and cannot be higher than `maxBuffer.stdout`. Also, with synchronous methods, this is measured in bytes instead of [characters or lines](output.md#big-output), for the same reason.
1037
1037
1038
-
When reached, [`error.isMaxBuffer`](#errorismaxbuffer) becomes `true`.
1038
+
When reached, [`error.isMaxBuffer`](#errorismaxbuffer) becomes `true` and the subprocess is terminated with the [`killSignal`](#optionskillsignal) option.
-[`error.isGracefullyCanceled`](api.md#errorisgracefullycanceled): `cancelSignal` option, if the [`gracefulCancel`](termination.md#graceful-termination) option is `true`.
-[`error.isTerminated`](api.md#erroristerminated): [signal termination](termination.md#signal-termination). This includes the [`timeout`](termination.md#timeout) and [`forceKillAfterDelay`](termination.md#forceful-termination) options since those terminate the subprocess with a [signal](termination.md#default-signal). This also includes the [`cancelSignal`](termination.md#canceling) option unless the [`gracefulCancel`](termination.md#graceful-termination) option is `true`. This does not include the [`maxBuffer`](output.md#big-output) option.
59
+
-[`error.isTerminated`](api.md#erroristerminated): [signal termination](termination.md#signal-termination). This includes the [`timeout`](termination.md#timeout) and [`forceKillAfterDelay`](termination.md#forceful-termination) options since those terminate the subprocess with a [signal](termination.md#default-signal). This also includes the [`cancelSignal`](termination.md#canceling) option unless the [`gracefulCancel`](termination.md#graceful-termination) option is `true`, and the [`maxBuffer`](output.md#big-output) option, since reaching the limit terminates the subprocess with the [`killSignal`](api.md#optionskillsignal) option, unless the subprocess exits on its own, for example by handling `killSignal`. With [synchronous methods](execution.md#synchronous-execution), the subprocess is only terminated when its total output exceeds `maxBuffer.stdout`.
60
60
61
61
Otherwise, the subprocess failed because either:
62
62
- An exception was thrown in a [stream](streams.md) or [transform](transform.md).
To prevent high memory consumption, a maximum output size can be set using the [`maxBuffer`](api.md#optionsmaxbuffer) option. It defaults to 100MB.
173
173
174
-
When this threshold is hit, the subprocess fails and [`error.isMaxBuffer`](api.md#errorismaxbuffer) becomes `true`. The truncated output is still available using [`error.stdout`](api.md#resultstdout), [`error.stderr`](api.md#resultstderr) and [`error.ipcOutput`](api.md#resultipcoutput).
174
+
When this threshold is hit, [`error.isMaxBuffer`](api.md#errorismaxbuffer) becomes `true` and the subprocess is terminated with the [`killSignal`](api.md#optionskillsignal) option. The truncated output is still available using [`error.stdout`](api.md#resultstdout), [`error.stderr`](api.md#resultstderr) and [`error.ipcOutput`](api.md#resultipcoutput).
175
175
176
176
This is measured:
177
177
- By default: in [characters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length).
Copy file name to clipboardExpand all lines: types/arguments/options.d.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -194,7 +194,7 @@ export type CommonOptions<
194
194
195
195
With synchronous methods, this cannot be enforced per file descriptor while the subprocess runs, since `spawnSync()` only accepts a single value, which limits the total output of all file descriptors. The `maxBuffer.stdout` value is used for it. The other file descriptors' own values are enforced from the output, once the subprocess ended, and cannot be higher than `maxBuffer.stdout`. Also, with synchronous methods, this is measured in bytes instead of characters or lines, for the same reason.
196
196
197
-
When reached, `error.isMaxBuffer` becomes `true`.
197
+
When reached, `error.isMaxBuffer` becomes `true` and the subprocess is terminated with the `killSignal` option.
0 commit comments