From d016d59957a74d42be81336e96b8b96d5bc0b3a1 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 9 May 2024 12:21:30 +0200 Subject: Handle exception thrown by fdterm_color() --- libbuild2/diagnostics.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libbuild2') 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). -- cgit v1.1