xcopy/tests: Fix the test in case stdin has been redirected.
Francois Gouget
fgouget at codeweavers.com
Fri Feb 28 12:50:32 CST 2014
On Windows 2003 and older xcopy exits prematurely if stdin does not
point to the console, even when provided with the '/I /Y' options.
Furthermore in that case the return code is 0 which trips up the test.
---
This explains why this test was failing on my test VMs: netcat redirects
stdin/stdout to the socket before starting winetest.exe, thus triggering
the above condition. The WineTestBot does not (currently) do that and
thus has not been affected.
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 4cd6b1a..ec7683a 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;
--
1.8.5.3
More information about the wine-patches
mailing list