Skip to content

Commit

Permalink
doc: mention process.*.isTTY under process
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasbynens authored and bnoordhuis committed Mar 25, 2013
1 parent 44843a6 commit 488b74d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions doc/api/process.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,20 @@ that writes to them 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 non-blocking like other streams.

To check if Node is being run in a TTY context, read the `isTTY` property
on `process.stderr`, `process.stdout`, or `process.stdin`:

$ node -p "Boolean(process.stdin.isTTY)"
true
$ echo "foo" | node -p "Boolean(process.stdin.isTTY)"
false

$ node -p "Boolean(process.stdout.isTTY)"
true
$ node -p "Boolean(process.stdout.isTTY)" | cat
false

See [the tty docs](tty.html#tty_tty) for more information.

## process.stderr

Expand Down

0 comments on commit 488b74d

Please sign in to comment.