node
node copied to clipboard
bootstrap: try-catch around potentially failing stream.write() for `node --help`
fixes #51448
how would i go about adding a test? 😵 the 'message' and 'pseudo-tty' folders dont seem to support node --help | head -n1
piping... do they? am i missing something obvious (probably)
In https://github.com/nodejs/node/issues/51448#issuecomment-1890829515 it was mentioned that console.log() can swallow the error too (by default, console.log() swallows all errors except stack overflow). I'd prefer that instead of special casing EPIPE since the purpose is similar (only stack overflow errors should be rethrown).
CI: https://ci.nodejs.org/job/node-test-pull-request/57352/
CI: https://ci.nodejs.org/job/node-test-pull-request/57533/
ci failures extracted for reading convenience:
https://ci.nodejs.org/job/node-test-commit-linux-containered/nodes=ubuntu2204_sharedlibs_shared_x64/41902/console
09:58:52 not ok 4088 sequential/test-watch-mode-inspect # TODO : Fix flaky test
09:58:52 ---
09:58:52 duration_ms: 120028.02600
09:58:52 severity: fail
09:58:52 exitcode: -15
09:58:52 stack: |-
09:58:52 timeout
09:58:52 [test] Connecting to a child Node process
09:58:52 [test] Testing /json/list
09:58:52 TAP version 13
09:58:52 [err] (node:2857497) ExperimentalWarning: Watch mode is an experimental feature and might change at any time
09:58:52 [err] (Use `node --trace-warnings ...` to show where the warning was created)
09:58:52 [err]
09:58:52 [err] Debugger listening on ws://127.0.0.1:39547/16cc9a88-02fe-47c2-a281-bc30b249b35d
09:58:52 [err]
09:58:52 [err] For help, see: https://nodejs.org/en/docs/inspector
09:58:52 [err]
09:58:52 [err] Debugger attached.
09:58:52 [err]
09:58:52 [test] Connecting to a child Node process
09:58:52 [test] Testing /json/list
09:58:52 [err] Debugger ending on ws://127.0.0.1:39547/16cc9a88-02fe-47c2-a281-bc30b249b35d
09:58:52 [err] For help, see: https://nodejs.org/en/docs/inspector
09:58:52 [err]
09:58:52 [out] safe to debug now
09:58:52 [out]
https://ci.nodejs.org/job/node-test-commit-linuxone/nodes=rhel8-s390x/42487/console
not ok 3744 pummel/test-net-pause
09:26:43 ---
09:26:43 duration_ms: 813.53300
09:26:43 severity: fail
09:26:43 exitcode: 1
09:26:43 stack: |-
09:26:43 pause at: 0
09:26:43 node:assert:126
09:26:43 throw new AssertionError(obj);
09:26:43 ^
09:26:43
09:26:43 AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
09:26:43
09:26:43 false !== true
09:26:43
09:26:43 at Timeout._onTimeout (/home/iojs/build/workspace/node-test-commit-linuxone/test/pummel/test-net-pause.js:56:12)
09:26:43 at listOnTimeout (node:internal/timers:573:17)
09:26:43 at process.processTimers (node:internal/timers:514:7) {
09:26:43 generatedMessage: true,
09:26:43 code: 'ERR_ASSERTION',
09:26:43 actual: false,
09:26:43 expected: true,
09:26:43 operator: 'strictEqual'
09:26:43 }
09:26:43
09:26:43 Node.js v22.0.0-pre
i think i fixed ci failures. now uses console.log(). require()
-ed after the bootstrap() function.
do i still need a test? how would i even go about adding such a test? 😵
CI: https://ci.nodejs.org/job/node-test-pull-request/57595/
About how this can be reproduced - one possible solution is, create a TCP socket, call end()
on it on this end, pass it as your stdout to a spawned child process, which does node --help
. (not 100% sure here, some additional coordination might be necessary, but the idea of using an ended TCP socket should be valid).
i added a test that i think works. it CORRECTLY FAILS on my installed node v21.7.1.
CI: https://ci.nodejs.org/job/node-test-pull-request/59114/
CI: https://ci.nodejs.org/job/node-test-pull-request/59179/
CI: https://ci.nodejs.org/job/node-test-pull-request/59186/
CI: https://ci.nodejs.org/job/node-test-pull-request/59189/
Landed in c7d53f0169aba592d61b1f2d13c39e5dd4817c7e