Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6f58bc5

Browse files
bnoordhuisrvagg
authored andcommittedFeb 8, 2016
doc: console is asynchronous unless it's a file
Mea culpa, looks like I forgot to update console.markdown in commit dac1d38 ("doc: stdout/stderr can block when directed to file"). This commit rectifies that. Refs: #5131 PR-URL: #5133 Reviewed-By: Brian White <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
1 parent f513e66 commit 6f58bc5

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed
 

‎doc/api/console.markdown

+4-13
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,10 @@ duplicate the browsers functionality exactly.
5353

5454
## Asynchronous vs Synchronous Consoles
5555

56-
The console functions are synchronous when the destination is a terminal or
57-
a file (to avoid lost messages in case of premature exit) and asynchronous
58-
when the destination is a pipe (to avoid blocking for long periods of time).
59-
60-
In the following example, stdout is non-blocking while stderr is blocking:
61-
62-
```
63-
$ node script.js 2> error.log | tee info.log
64-
```
65-
66-
Typically, the distinction between blocking/non-blocking is not important
67-
unless an application is logging significant amounts of data. High volume
68-
logging *should* use a `Console` instance that writes to a pipe.
56+
The console functions are asynchronous unless the destination is a file.
57+
Disks are fast and operating systems normally employ write-back caching;
58+
it should be a very rare occurrence indeed that a write blocks, but it
59+
is possible.
6960

7061
## Class: Console
7162

0 commit comments

Comments
 (0)
Please sign in to comment.