Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a0db5fb

Browse filesBrowse files
bnoordhuisrvagg
authored andcommitted
doc: stdout/stderr can block when directed to file
Update the documentation for `process.stdout` and `process.stdout` to clarify that writes can block when stdio is redirected to a file. In all other cases, it's non-blocking. PR-URL: #3170 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
1 parent 409f299 commit a0db5fb
Copy full SHA for a0db5fb

File tree

Expand file treeCollapse file tree

1 file changed

+6
-9
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-9
lines changed
Open diff view settings
Collapse file

‎doc/api/process.markdown‎

Copy file name to clipboardExpand all lines: doc/api/process.markdown
+6-9Lines changed: 6 additions & 9 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,9 @@ For example, a `console.log` equivalent could look like this:
282282

283283
`process.stderr` and `process.stdout` are unlike other streams in Node.js in
284284
that they cannot be closed (`end()` will throw), they never emit the `finish`
285-
event and that writes are always blocking.
285+
event and that writes can block when output is redirected to a file (although
286+
disks are fast and operating systems normally employ write-back caching so it
287+
should be a very rare occurrence indeed.)
286288

287289
To check if Node.js is being run in a TTY context, read the `isTTY` property
288290
on `process.stderr`, `process.stdout`, or `process.stdin`:
@@ -305,14 +307,9 @@ A writable stream to stderr (on fd `2`).
305307

306308
`process.stderr` and `process.stdout` are unlike other streams in Node.js in
307309
that they cannot be closed (`end()` will throw), they never emit the `finish`
308-
event and that writes are usually blocking.
309-
310-
- They are blocking in the case that they refer to regular files or TTY file
311-
descriptors.
312-
- In the case they refer to pipes:
313-
- They are blocking in Linux/Unix.
314-
- They are non-blocking like other streams in Windows.
315-
310+
event and that writes can block when output is redirected to a file (although
311+
disks are fast and operating systems normally employ write-back caching so it
312+
should be a very rare occurrence indeed.)
316313

317314
## process.stdin
318315

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.