Skip to content

Commit dac1d38

Browse files
committed
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 <[email protected]>
1 parent 363a4e9 commit dac1d38

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

doc/api/process.markdown

+6-9
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)