summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwszqkzqk <wszqkzqk@qq.com>2023-01-03 23:12:24 +0800
committerRico Tzschichholz <ricotz@ubuntu.com>2023-01-04 11:09:26 +0100
commitd6b9e6aace8388d76a29b3df83413dec76324833 (patch)
tree9fd1d46c0a931fdbeb9ce56127e88fbf432087d0
parentc5679d09cdc8b49c9b886fc6617db901350c301d (diff)
downloadvala-d6b9e6aace8388d76a29b3df83413dec76324833.tar.gz
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
-rw-r--r--libvaladoc/errorreporter.vala7
-rw-r--r--vala/valareport.vala7
2 files changed, 10 insertions, 4 deletions
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;
}
}