Skip to content

Commit 78da06f

Browse files
SamirTalwarfacebook-github-bot
authored andcommitted
[PR] Carry on even if there is no TERM environment variable set.
Summary: There are a few continuous integration systems which act as STDOUT is a TTY, but don't set `TERM`. On those occasions, we get the following error message: Fatal error: exception Not_found This, obviously, makes it pretty hard to figure out what the actual problem is. An alternative implementation could throw a better error, but it felt like defaulting to `"dumb"` was a reasonable solution here. I couldn't see a reasonable place to put tests, so I omitted them. If there is, please let me know. Closes facebook#3305 Differential Revision: D4486056 Pulled By: mroch fbshipit-source-id: e3a7cf88d6edc49e603b18a7e7f1ba11089eb0b7
1 parent 46bab02 commit 78da06f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/common/utils_js.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ let prerr_endlinef fmt = Printf.ksprintf prerr_endline fmt
1818
let can_emoji =
1919
Sys.os_type <> "Win32" &&
2020
Unix.isatty Unix.stdout &&
21-
Sys.getenv "TERM" <> "dumb"
21+
(try Sys.getenv "TERM" with Not_found -> "dumb") <> "dumb"
2222

2323
(* JSON numbers must not end in a `.`, but string_of_float returns things like
2424
`1.` instead of `1.0`, so we want to truncate the `.` *)

0 commit comments

Comments
 (0)