From 8d51235dbeca036f91d6b6022944894f6abe962b Mon Sep 17 00:00:00 2001 From: Francois Gouget Date: Fri, 28 Feb 2014 19:50:32 +0100 Subject: [PATCH] xcopy/tests: Fix the test in case stdin has been redirected. --- programs/xcopy/tests/xcopy.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/programs/xcopy/tests/xcopy.c b/programs/xcopy/tests/xcopy.c index 4cd6b1aa07c..ec7683aecc2 100644 --- a/programs/xcopy/tests/xcopy.c +++ b/programs/xcopy/tests/xcopy.c @@ -31,7 +31,11 @@ static DWORD runcmd(const char* cmd) /* Create a writable copy for CreateProcessA() */ wcmd = HeapAlloc(GetProcessHeap(), 0, strlen(cmd) + 1); strcpy(wcmd, cmd); - rc = CreateProcessA(NULL, wcmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); + + /* On Windows 2003 and older, xcopy.exe fails if stdin is not a console + * handle, even with '/I /Y' options. + */ + rc = CreateProcessA(NULL, wcmd, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi); HeapFree(GetProcessHeap(), 0, wcmd); if (!rc) return 260;