[v2,13/16] lib: isatty is not available on windows

Message ID 20221217165213.152-14-luoyonggang@gmail.com
State Dropped
Headers
Series Patches for building with mingw/gcc msvc/clang-cl |

Commit Message

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

Comments

lilydjwg--- via Elfutils-devel Dec. 19, 2022, 12:32 p.m. UTC | #1
It's because lack  STDOUT_FILENO, so this patch can be dropped

On Sun, Dec 18, 2022 at 12:52 AM Yonggang Luo <luoyonggang@gmail.com> wrote:
>
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> ---
>  lib/color.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> 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)
> --
> 2.36.1.windows.1
>


--
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo
  

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)