Skip to content

Add stdinIsTTY (#30) #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Breaking changes:

New features:

- Added `stdinIsTTY` as the counterpart of `process.stdin.isTTY` (#31 by @matoruru)

Bugfixes:

Other improvements:
Expand Down
6 changes: 6 additions & 0 deletions src/Node/Process.purs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module Node.Process
, stdin
, stdout
, stderr
, stdinIsTTY
, stdoutIsTTY
, stderrIsTTY
, version
Expand Down Expand Up @@ -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).
Expand Down