File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 77
77
#include <stdio.h>
78
78
#include <stdlib.h>
79
79
#include <stdarg.h>
80
+ #include <unistd.h>
80
81
81
82
82
83
#if __WIN32__
@@ -207,7 +208,7 @@ void text_color_init (int enable_color)
207
208
g_enable_color = enable_color ;
208
209
209
210
210
- if (g_enable_color == 0 ) {
211
+ if (g_enable_color == 0 || isatty ( fileno ( stdout )) == 0 ) {
211
212
return ;
212
213
}
213
214
#if __WIN32__
@@ -250,7 +251,7 @@ void text_color_set ( enum dw_color_e c )
250
251
WORD attr ;
251
252
HANDLE h ;
252
253
253
- if (g_enable_color == 0 ) {
254
+ if (g_enable_color == 0 || isatty ( fileno ( stdout )) == 0 ) {
254
255
return ;
255
256
}
256
257
@@ -294,7 +295,7 @@ void text_color_set ( enum dw_color_e c )
294
295
void text_color_set ( enum dw_color_e c )
295
296
{
296
297
297
- if (g_enable_color == 0 ) {
298
+ if (g_enable_color == 0 || isatty ( fileno ( stdout )) == 0 ) {
298
299
return ;
299
300
}
300
301
You can’t perform that action at this time.
0 commit comments