Skip to content

Commit 5e60f67

Browse files
committed
Add stdinIsTTY (purescript-node#30)
1 parent a3894cf commit 5e60f67

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Node/Process.purs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ module Node.Process
2020
, stdin
2121
, stdout
2222
, stderr
23+
, stdinIsTTY
2324
, stdoutIsTTY
2425
, stderrIsTTY
2526
, version
@@ -151,6 +152,11 @@ stdout = process.stdout
151152
stderr :: Writable ()
152153
stderr = process.stderr
153154

155+
-- | Check whether the standard input stream appears to be attached to a TTY.
156+
-- | It is a good idea to check this before processing the input data from stdin.
157+
stdinIsTTY :: Boolean
158+
stdinIsTTY = process.stdin.isTTY
159+
154160
-- | Check whether the standard output stream appears to be attached to a TTY.
155161
-- | It is a good idea to check this before printing ANSI codes to stdout
156162
-- | (e.g. for coloured text in the terminal).

0 commit comments

Comments
 (0)