diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2015-10-04 00:15:08 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2015-11-05 17:27:45 +0100 |
commit | dac1d38a02398d65615496b1679cb071ff45a4f0 (patch) | |
tree | eee240fd3ec0468efa24c5d28fc89577acec0e7d | |
parent | 363a4e922368e21f18827210f1d2b0c54a55e88f (diff) | |
download | node-new-dac1d38a02398d65615496b1679cb071ff45a4f0.tar.gz |
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: https://github.com/nodejs/node/pull/3170
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
-rw-r--r-- | doc/api/process.markdown | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/doc/api/process.markdown b/doc/api/process.markdown index eecf494c48..0c32799a66 100644 --- a/doc/api/process.markdown +++ b/doc/api/process.markdown @@ -282,7 +282,9 @@ For example, a `console.log` equivalent could look like this: `process.stderr` and `process.stdout` are unlike other streams in Node.js in that they cannot be closed (`end()` will throw), they never emit the `finish` -event and that writes are always blocking. +event and that writes can block when output is redirected to a file (although +disks are fast and operating systems normally employ write-back caching so it +should be a very rare occurrence indeed.) To check if Node.js is being run in a TTY context, read the `isTTY` property on `process.stderr`, `process.stdout`, or `process.stdin`: @@ -305,14 +307,9 @@ A writable stream to stderr (on fd `2`). `process.stderr` and `process.stdout` are unlike other streams in Node.js in that they cannot be closed (`end()` will throw), they never emit the `finish` -event and that writes are usually blocking. - -- They are blocking in the case that they refer to regular files or TTY file - descriptors. -- In the case they refer to pipes: - - They are blocking in Linux/Unix. - - They are non-blocking like other streams in Windows. - +event and that writes can block when output is redirected to a file (although +disks are fast and operating systems normally employ write-back caching so it +should be a very rare occurrence indeed.) ## process.stdin |