]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: fix TTY check in virTestUseTerminalColors()
authorPino Toscano <ptoscano@redhat.com>
Thu, 9 Nov 2017 12:31:03 +0000 (13:31 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Fri, 10 Nov 2017 15:12:43 +0000 (16:12 +0100)
Since colors would be used when writing to stdout, then check that
stdout is a TTY, instead of stdin.

This avoids the usage of terminal color codes when the output is
directed to file.

tests/testutils.c

index 915cd3b7925bf98eb26ed0d19cd8a826d929a216..9266f15e85b655b513f90aec6dc2cc8ee566c5ac 100644 (file)
@@ -92,7 +92,7 @@ bool virTestOOMActive(void)
 
 static int virTestUseTerminalColors(void)
 {
-    return isatty(STDIN_FILENO);
+    return isatty(STDOUT_FILENO);
 }
 
 static unsigned int