From: wszqkzqk Date: Tue, 3 Jan 2023 15:12:24 +0000 (+0800) Subject: vala,libvaladoc: Properly check for colored terminal output on Windows X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6b9e6aace8388d76a29b3df83413dec76324833;p=thirdparty%2Fvala.git vala,libvaladoc: Properly check for colored terminal output on Windows Additionally look for `_isatty()` and adjust for more possible results Fixes https://gitlab.gnome.org/GNOME/vala/issues/1383 --- diff --git a/libvaladoc/errorreporter.vala b/libvaladoc/errorreporter.vala index 68b09a8ef..d63ed6ecd 100644 --- a/libvaladoc/errorreporter.vala +++ b/libvaladoc/errorreporter.vala @@ -240,11 +240,14 @@ public class Valadoc.ErrorReporter : Object { void* _func; module.symbol ("isatty", out _func); if (_func == null) { - return false; + module.symbol ("_isatty", out _func); + if (_func == null) { + return false; + } } AttyFunc? func = (AttyFunc) _func; - return func (fd) == 1; + return func (fd) > 0; } [PrintfFormat] diff --git a/vala/valareport.vala b/vala/valareport.vala index bdb11236f..081f37c42 100644 --- a/vala/valareport.vala +++ b/vala/valareport.vala @@ -410,10 +410,13 @@ public class Vala.Report { void* _func; module.symbol ("isatty", out _func); if (_func == null) { - return false; + module.symbol ("_isatty", out _func); + if (_func == null) { + return false; + } } AttyFunc? func = (AttyFunc) _func; - return func (fd) == 1; + return func (fd) > 0; } }