[PATCH] kernel32/tests: Detect and handle a redirected stdin.

Alexandre Julliard julliard at winehq.org
Thu Nov 2 11:09:32 CDT 2017


Alex Henrie <alexhenrie24 at gmail.com> writes:

> @@ -2572,7 +2572,7 @@ static void test_ReadConsoleOutputAttribute(HANDLE output_handle)
>      ok(count == 1, "Expected count to be 1, got %u\n", count);
>  }
>  
> -static void test_ReadConsole(void)
> +static void test_ReadConsole(HANDLE input_handle)
>  {
>      HANDLE std_input;
>      DWORD ret, bytes;
> @@ -2582,6 +2582,13 @@ static void test_ReadConsole(void)
>  
>      SetLastError(0xdeadbeef);
>      ret = GetFileSize(std_input, NULL);
> +    if (GetLastError() == 0xdeadbeef)
> +    {
> +        /* print a warning and cheat a little so that the tests can continue */
> +        skip("stdin appears to be redirected; if it's not then this is an error");
> +        std_input = input_handle;
> +        ret = GetFileSize(std_input, NULL);
> +    }

I'm not sure why we'd need to use stdin at all then, we might as well
always use the proper console handle.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list