Make sure colors and emoji are disabled when not on TTY

This commit is contained in:
Philippe Teuwen
2020-04-25 15:10:34 +02:00
parent a8ff7b4815
commit a15d14e038
2 changed files with 7 additions and 1 deletions

View File

@@ -908,6 +908,12 @@ int main(int argc, char *argv[]) {
session.supports_colors = true;
session.emoji_mode = EMOJI;
}
} else {
// even if prefs, we disable colors if stdin or stdout is not a TTY
if ((! session.stdinOnTTY) || (! session.stdoutOnTTY)) {
session.supports_colors = false;
session.emoji_mode = ALTTEXT;
}
}
#else
if (session.stdinOnTTY && session.stdoutOnTTY) {