From 811f3e6713029beab26e77cc64769a08398d2177 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 24 Jan 2011 13:15:06 +0200 Subject: Windows fixes for output redirection --- odb/odb.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'odb/odb.cxx') diff --git a/odb/odb.cxx b/odb/odb.cxx index 8f0ba5b..d8576d2 100644 --- a/odb/odb.cxx +++ b/odb/odb.cxx @@ -22,6 +22,7 @@ # endif # include // CreatePipe, CreateProcess # include // _open_osfhandle +# include // _O_TEXT #endif #include @@ -1218,6 +1219,10 @@ start_process (char const* args[], char const* name, bool out) } CloseHandle (pi.hThread); + CloseHandle (out_h[0]); + + if (out) + CloseHandle (in_h[1]); process_info r; r.id = pi.hProcess; @@ -1231,7 +1236,9 @@ start_process (char const* args[], char const* name, bool out) if (out) { - r.in_fd = _open_osfhandle ((intptr_t) (in_h[0]), 0); + // Pass _O_TEXT to get newline translation. + // + r.in_fd = _open_osfhandle ((intptr_t) (in_h[0]), _O_TEXT); if (r.in_fd == -1) { -- cgit v1.1