aboutsummaryrefslogtreecommitdiff
path: root/odb/odb.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-01-24 13:15:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-01-24 13:15:06 +0200
commit811f3e6713029beab26e77cc64769a08398d2177 (patch)
tree49b3b2ffe55b252db3d0e0adaef11f5dd57ae385 /odb/odb.cxx
parentb23a9875120de78cf6172da774743dc35588c1ee (diff)
Windows fixes for output redirection
Diffstat (limited to 'odb/odb.cxx')
-rw-r--r--odb/odb.cxx9
1 files changed, 8 insertions, 1 deletions
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 <windows.h> // CreatePipe, CreateProcess
# include <io.h> // _open_osfhandle
+# include <fcntl.h> // _O_TEXT
#endif
#include <set>
@@ -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)
{