aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/b.cxx17
1 files changed, 14 insertions, 3 deletions
diff --git a/build2/b.cxx b/build2/b.cxx
index 9ffb6d1..a51a81a 100644
--- a/build2/b.cxx
+++ b/build2/b.cxx
@@ -7,7 +7,7 @@
#include <exception> // terminate(), set_terminate(), terminate_handler
#include <libbutl/pager.hxx>
-#include <libbutl/fdstream.hxx> // stderr_fd(), fdterm()
+#include <libbutl/fdstream.hxx> // stderr_fd(), fdterm(), std*_fdmode()
#include <libbutl/backtrace.hxx> // backtrace()
#ifndef BUILD2_BOOTSTRAP
@@ -249,8 +249,6 @@ main (int argc, char* argv[])
tracer trace ("main");
- init_process ();
-
int r (0);
b_options ops;
scheduler sched;
@@ -261,6 +259,19 @@ main (int argc, char* argv[])
try
{
+ try
+ {
+ stdin_fdmode (fdstream_mode::blocking);
+ stdout_fdmode (fdstream_mode::blocking);
+ stderr_fdmode (fdstream_mode::blocking);
+ }
+ catch (const io_error& e)
+ {
+ fail << "unable to turn standard streams into blocking mode: " << e;
+ }
+
+ init_process ();
+
// Parse the command line.
//
b_cmdline cmdl (parse_b_cmdline (trace, argc, argv, ops));