| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1a9582b commit ea5628e
8 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1172,12 +1172,32 @@ A call was made and the UDP subsystem was not running. | |||
| 1172 | 1172 | <a id="ERR_STDERR_CLOSE"></a> | |
| 1173 | 1173 | ### ERR_STDERR_CLOSE | |
| 1174 | 1174 | ||
| 1175 | + <!-- YAML | ||
| 1176 | + removed: REPLACEME | ||
| 1177 | + changes: | ||
| 1178 | + - version: REPLACEME | ||
| 1179 | + pr-url: https://github.com/nodejs/node/pull/23053 | ||
| 1180 | + description: Rather than emitting an error, `process.stderr.end()` now | ||
| 1181 | + only closes the stream side but not the underlying resource, | ||
| 1182 | + making this error obsolete. | ||
| 1183 | + --> | ||
| 1184 | + | ||
| 1175 | 1185 | An attempt was made to close the `process.stderr` stream. By design, Node.js | |
| 1176 | 1186 | does not allow `stdout` or `stderr` streams to be closed by user code. | |
| 1177 | 1187 | ||
| 1178 | 1188 | <a id="ERR_STDOUT_CLOSE"></a> | |
| 1179 | 1189 | ### ERR_STDOUT_CLOSE | |
| 1180 | 1190 | ||
| 1191 | + <!-- YAML | ||
| 1192 | + removed: REPLACEME | ||
| 1193 | + changes: | ||
| 1194 | + - version: REPLACEME | ||
| 1195 | + pr-url: https://github.com/nodejs/node/pull/23053 | ||
| 1196 | + description: Rather than emitting an error, `process.stderr.end()` now | ||
| 1197 | + only closes the stream side but not the underlying resource, | ||
| 1198 | + making this error obsolete. | ||
| 1199 | + --> | ||
| 1200 | + | ||
| 1181 | 1201 | An attempt was made to close the `process.stdout` stream. By design, Node.js | |
| 1182 | 1202 | does not allow `stdout` or `stderr` streams to be closed by user code. | |
| 1183 | 1203 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1703,9 +1703,7 @@ important ways: | |||
| 1703 | 1703 | ||
| 1704 | 1704 | 1. They are used internally by [`console.log()`][] and [`console.error()`][], | |
| 1705 | 1705 | respectively. | |
| 1706 | - 2. They cannot be closed ([`end()`][] will throw). | ||
| 1707 | - 3. They will never emit the [`'finish'`][] event. | ||
| 1708 | - 4. Writes may be synchronous depending on what the stream is connected to | ||
| 1706 | + 2. Writes may be synchronous depending on what the stream is connected to | ||
| 1709 | 1707 | and whether the system is Windows or POSIX: | |
| 1710 | 1708 | - Files: *synchronous* on Windows and POSIX | |
| 1711 | 1709 | - TTYs (Terminals): *asynchronous* on Windows, *synchronous* on POSIX | |
@@ -1925,7 +1923,6 @@ cases: | |||
| 1925 | 1923 | ||
| 1926 | 1924 | ||
| 1927 | 1925 | [`'exit'`]: #process_event_exit | |
| 1928 | - [`'finish'`]: stream.html#stream_event_finish | ||
| 1929 | 1926 | [`'message'`]: child_process.html#child_process_event_message | |
| 1930 | 1927 | [`'rejectionHandled'`]: #process_event_rejectionhandled | |
| 1931 | 1928 | [`'uncaughtException'`]: #process_event_uncaughtexception | |
@@ -1936,7 +1933,6 @@ cases: | |||
| 1936 | 1933 | [`EventEmitter`]: events.html#events_class_eventemitter | |
| 1937 | 1934 | [`console.error()`]: console.html#console_console_error_data_args | |
| 1938 | 1935 | [`console.log()`]: console.html#console_console_log_data_args | |
| 1939 | - [`end()`]: stream.html#stream_writable_end_chunk_encoding_callback | ||
| 1940 | 1936 | [`net.Server`]: net.html#net_class_net_server | |
| 1941 | 1937 | [`net.Socket`]: net.html#net_class_net_socket | |
| 1942 | 1938 | [`process.argv`]: #process_process_argv | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -427,8 +427,6 @@ E('ERR_SOCKET_BUFFER_SIZE', | |||
| 427 | 427 | (reason) => `Could not get or set buffer size: ${reason}`); | |
| 428 | 428 | E('ERR_SOCKET_CANNOT_SEND', 'Unable to send data'); | |
| 429 | 429 | E('ERR_SOCKET_DGRAM_NOT_RUNNING', 'Not running'); | |
| 430 | - E('ERR_STDERR_CLOSE', 'process.stderr cannot be closed'); | ||
| 431 | - E('ERR_STDOUT_CLOSE', 'process.stdout cannot be closed'); | ||
| 432 | 430 | E('ERR_UNKNOWN_BUILTIN_MODULE', (id) => `No such built-in module: ${id}`); | |
| 433 | 431 | E('ERR_UNKNOWN_FILE_EXTENSION', 'Unknown file extension: %s'); | |
| 434 | 432 | E('ERR_UNKNOWN_MODULE_FORMAT', 'Unknown module format: %s'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,9 +1,11 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | - const errors = require('internal/errors'); | ||
| 3 | + const errors = require('internal/errors').codes; | ||
| 4 | 4 | ||
| 5 | 5 | exports.setup = setupStdio; | |
| 6 | 6 | ||
| 7 | + function dummyDestroy(err, cb) { cb(err); } | ||
| 8 | + | ||
| 7 | 9 | function setupStdio() { | |
| 8 | 10 | var stdin; | |
| 9 | 11 | var stdout; | |
@@ -13,11 +15,8 @@ function setupStdio() { | |||
| 13 | 15 | if (stdout) return stdout; | |
| 14 | 16 | stdout = createWritableStdioStream(1); | |
| 15 | 17 | stdout.destroySoon = stdout.destroy; | |
| 16 | - stdout._destroy = function(er, cb) { | ||
| 17 | - // Avoid errors if we already emitted | ||
| 18 | - er = er || new errors.Error('ERR_STDOUT_CLOSE'); | ||
| 19 | - cb(er); | ||
| 20 | - }; | ||
| 18 | + // Override _destroy so that the fd is never actually closed. | ||
| 19 | + stdout._destroy = dummyDestroy; | ||
| 21 | 20 | if (stdout.isTTY) { | |
| 22 | 21 | process.on('SIGWINCH', () => stdout._refreshSize()); | |
| 23 | 22 | } | |
@@ -28,11 +27,8 @@ function setupStdio() { | |||
| 28 | 27 | if (stderr) return stderr; | |
| 29 | 28 | stderr = createWritableStdioStream(2); | |
| 30 | 29 | stderr.destroySoon = stderr.destroy; | |
| 31 | - stderr._destroy = function(er, cb) { | ||
| 32 | - // Avoid errors if we already emitted | ||
| 33 | - er = er || new errors.Error('ERR_STDERR_CLOSE'); | ||
| 34 | - cb(er); | ||
| 35 | - }; | ||
| 30 | + // Override _destroy so that the fd is never actually closed. | ||
| 31 | + stdout._destroy = dummyDestroy; | ||
| 36 | 32 | if (stderr.isTTY) { | |
| 37 | 33 | process.on('SIGWINCH', () => stderr._refreshSize()); | |
| 38 | 34 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,9 +24,9 @@ function parent() { | |||
| 24 | 24 | }); | |
| 25 | 25 | ||
| 26 | 26 | child.on('close', function(code, signal) { | |
| 27 | - assert(code); | ||
| 27 | + assert.strictEqual(code, 0); | ||
| 28 | + assert.strictEqual(err, ''); | ||
| 28 | 29 | assert.strictEqual(out, 'foo'); | |
| 29 | - assert(/process\.stdout cannot be closed/.test(err)); | ||
| 30 | 30 | console.log('ok'); | |
| 31 | 31 | }); | |
| 32 | 32 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + Hello! | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,3 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + process.stderr.on('data', common.mustCall(console.log)); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + <Buffer 48 65 6c 6c 6f 21 0a> | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments