aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/diagnostics.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-05-09 12:21:30 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-05-09 12:21:30 +0200
commitd016d59957a74d42be81336e96b8b96d5bc0b3a1 (patch)
tree51b27bd2245d939234679745ac220b6625f7ed5b /libbuild2/diagnostics.cxx
parentc54e434be71e3cb8e71436cd7397bc4ab9957a7f (diff)
Handle exception thrown by fdterm_color()
Diffstat (limited to 'libbuild2/diagnostics.cxx')
-rw-r--r--libbuild2/diagnostics.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/libbuild2/diagnostics.cxx b/libbuild2/diagnostics.cxx
index 1fd1139..c795e44 100644
--- a/libbuild2/diagnostics.cxx
+++ b/libbuild2/diagnostics.cxx
@@ -60,7 +60,14 @@ namespace build2
// inherited by other processes we start (e.g., compilers) and/or
// whether they will do something sensible about any of this.
//
- stderr_term_color = fdterm_color (stderr_fd (), c && *c /* enable */);
+ try
+ {
+ stderr_term_color = fdterm_color (stderr_fd (), c && *c /* enable */);
+ }
+ catch (const io_error& e)
+ {
+ fail << "unable to query terminal color support for stderr: " << e;
+ }
// If the user specified --diag-color on POSIX we will trust the color
// is supported (e.g., wrong TERM value, etc).