summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2018-03-10 16:34:14 +0800
committerJohn Hodge <tpg@mutabah.net>2018-03-17 18:52:16 +0800
commita8db3fa4d52e667525cb200c0052e51d9e5b6e41 (patch)
treee207511c199e79ae37998ef9481cfd154b8fd573
parentafc5b5178baf01c257a01565e9b58f777c3d4c33 (diff)
downloadmrust-a8db3fa4d52e667525cb200c0052e51d9e5b6e41.tar.gz
testrunner - Capture stdout on windows
-rw-r--r--tools/testrunner/main.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/testrunner/main.cpp b/tools/testrunner/main.cpp
index 1185c2c3..2aa7e696 100644
--- a/tools/testrunner/main.cpp
+++ b/tools/testrunner/main.cpp
@@ -489,8 +489,16 @@ bool run_executable(const ::helpers::path& exe_name, const ::std::vector<const c
si.cb = sizeof(si);
si.dwFlags = STARTF_USESTDHANDLES;
si.hStdInput = NULL;
- si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
si.hStdError = GetStdHandle(STD_ERROR_HANDLE);
+ {
+ SECURITY_ATTRIBUTES sa = { 0 };
+ sa.nLength = sizeof(sa);
+ sa.bInheritHandle = TRUE;
+ si.hStdOutput = CreateFile( outfile.str().c_str(), GENERIC_WRITE, FILE_SHARE_READ, &sa, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
+ //DWORD tmp;
+ //WriteFile(si.hStdOutput, cmdline_str.data(), static_cast<DWORD>(cmdline_str.size()), &tmp, NULL);
+ //WriteFile(si.hStdOutput, "\n", 1, &tmp, NULL);
+ }
PROCESS_INFORMATION pi = { 0 };
CreateProcessA(exe_name.str().c_str(), (LPSTR)cmdline_str.c_str(), NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi);
CloseHandle(si.hStdOutput);