Skip to content

Commit 5dd9abb

Browse files
Add stdinIsTTY (#30) (#31)
Co-authored-by: Thomas Honeyman <admin@thomashoneyman.com>
1 parent a3894cf commit 5dd9abb

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Breaking changes:
88

99
New features:
1010

11+
- Added `stdinIsTTY` as the counterpart of `process.stdin.isTTY` (#31 by @matoruru)
12+
1113
Bugfixes:
1214

1315
Other improvements:

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)