diff --git a/CHANGELOG.md b/CHANGELOG.md index 62d1a9f..b66bd7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ Breaking changes: New features: + - Added `stdinIsTTY` as the counterpart of `process.stdin.isTTY` (#31 by @matoruru) + Bugfixes: Other improvements: diff --git a/src/Node/Process.purs b/src/Node/Process.purs index 39099d9..8589959 100644 --- a/src/Node/Process.purs +++ b/src/Node/Process.purs @@ -20,6 +20,7 @@ module Node.Process , stdin , stdout , stderr + , stdinIsTTY , stdoutIsTTY , stderrIsTTY , version @@ -151,6 +152,11 @@ stdout = process.stdout stderr :: Writable () stderr = process.stderr +-- | Check whether the standard input stream appears to be attached to a TTY. +-- | It is a good idea to check this before processing the input data from stdin. +stdinIsTTY :: Boolean +stdinIsTTY = process.stdin.isTTY + -- | Check whether the standard output stream appears to be attached to a TTY. -- | It is a good idea to check this before printing ANSI codes to stdout -- | (e.g. for coloured text in the terminal).