Skip to content

Commit 8321f09

Browse files
committed
Add stderrIsTTY
1 parent 464a186 commit 8321f09

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Node/Process.purs

+10-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module Node.Process
1919
, stdout
2020
, stderr
2121
, stdoutIsTTY
22+
, stderrIsTTY
2223
, version
2324
) where
2425

@@ -132,10 +133,18 @@ stdout = process.stdout
132133
stderr :: forall eff. Writable () (console :: CONSOLE, err :: EXCEPTION | eff)
133134
stderr = process.stderr
134135

135-
-- | Check whether the process is being run inside a TTY context
136+
-- | Check whether the standard output stream appears to be attached to a TTY.
137+
-- | It is a good idea to check this before printing ANSI codes to stdout
138+
-- | (e.g. for coloured text in the terminal).
136139
stdoutIsTTY :: Boolean
137140
stdoutIsTTY = process.stdout.isTTY
138141

142+
-- | Check whether the standard error stream appears to be attached to a TTY.
143+
-- | It is a good idea to check this before printing ANSI codes to stderr
144+
-- | (e.g. for coloured text in the terminal).
145+
stderrIsTTY :: Boolean
146+
stderrIsTTY = process.stderr.isTTY
147+
139148
-- | Get the Node.js version.
140149
version :: String
141150
version = process.version

0 commit comments

Comments
 (0)