Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMathias Bynens <mathias@qiwi.be>2013-03-19 12:10:23 +0400
committerBen Noordhuis <info@bnoordhuis.nl>2013-03-25 16:54:32 +0400
commit488b74d68bc259c066351dd24adebbdeb53f4d24 (patch)
treed33b2fb37c0bbc5f74f0c09af1d77a9f5afae60c /doc
parent44843a60629ab5951a9c54ac6bf74208d607e3e0 (diff)
doc: mention `process.*.isTTY` under `process`
Diffstat (limited to 'doc')
-rw-r--r--doc/api/process.markdown14
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/api/process.markdown b/doc/api/process.markdown
index 639bdd74bd3..c345da76900 100644
--- a/doc/api/process.markdown
+++ b/doc/api/process.markdown
@@ -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