diff options
author | John Hodge <tpg@mutabah.net> | 2018-03-10 16:34:14 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2018-03-10 16:34:14 +0800 |
commit | 0f8cca87de85e0387a3e6e6cbb4a75656e649ed5 (patch) | |
tree | e207511c199e79ae37998ef9481cfd154b8fd573 /tools/testrunner/main.cpp | |
parent | a1b899c3712820d0b38031655385a602bd3c2158 (diff) | |
download | mrust-0f8cca87de85e0387a3e6e6cbb4a75656e649ed5.tar.gz |
testrunner - Capture stdout on windows
Diffstat (limited to 'tools/testrunner/main.cpp')
-rw-r--r-- | tools/testrunner/main.cpp | 10 |
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); |