diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2024-09-04 10:37:31 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2024-09-04 10:38:24 +0300 |
commit | 1b7f72ed98d51b9fe01173cb5e4b47a3b3a7f6f7 (patch) | |
tree | 652838b5efc70709d50f76025e47f184ea63279e | |
parent | 6900b21b1180ffa590f3e97d6be75c37707990ca (diff) |
Turn standard streams into blocking mode on start (GH issue 417)
-rw-r--r-- | build2/b.cxx | 17 |
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)); |