[24/25] lib: isatty is not available on windows

Message ID 20221020182603.815-25-luoyonggang@gmail.com
State Superseded
Headers
Series Patches for building with mingw/gcc msvc/clang-cl |

Commit Message

Yonggang Luo Oct. 20, 2022, 6:26 p.m. UTC
  Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
 lib/color.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Patch

diff --git a/lib/color.c b/lib/color.c
index 8063dc26..963a2ec2 100644
--- a/lib/color.c
+++ b/lib/color.c
@@ -117,9 +117,14 @@  parse_opt (int key, char *arg,
 	    if (strcmp (arg, values[i].str) == 0)
 	      {
 		color_mode = values[i].mode;
+#ifdef _WIN32
+		if (color_mode == color_auto)
+			color_mode = color_never;
+#else
 		if (color_mode == color_auto)
 		  color_mode
 		    = isatty (STDOUT_FILENO) ? color_always : color_never;
+#endif
 		break;
 	      }
 	  if (i == nvalues)