[Boost-bugs] [Boost C++ Libraries] #13358: boost::process on_exit fails when using multiple processes

Subject: [Boost-bugs] [Boost C++ Libraries] #13358: boost::process on_exit fails when using multiple processes
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-12-22 15:30:29


#13358: boost::process on_exit fails when using multiple processes
------------------------------+---------------------
 Reporter: david.glesser@… | Owner: (none)
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: process
  Version: Boost 1.65.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------
 {{{
 int main() {
     boost::asio::io_service ios;
     boost::asio::io_service::work working(ios);

     proc::child c1("/bin/sleep 1", ios, proc::on_exit=[](int exit, const
 std::error_code& ec_in){std::cout<<"11111"<<std::endl;});
     proc::child c2("/bin/sleep 4", ios, proc::on_exit=[](int exit, const
 std::error_code& ec_in){std::cout<<"44444"<<std::endl;});
     proc::child c3("/bin/sleep 2", ios, proc::on_exit=[](int exit, const
 std::error_code& ec_in){std::cout<<"22222"<<std::endl;});
     ios.run();

     return 0;
 }

 }}}

 prints

 {{{
 22222
 44444
 11111
 }}}

 while it should prints 11111, 22222 and then 44444. However, 22222 is
 printed after 1 second, 44444 after 2s, and 11111 after 4s.

 The same error happen if you use:

 {{{
     boost::process::async_system(ios, [](boost::system::error_code,
 int){std::cout << "11111" << std::endl;}, "/bin/sleep 1");
 }}}

 This was observed on an up-to-date Archlinux (as of 2017-12-22) with gcc
 7.2.1 and clang 5.0.0.

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13358>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-12-22 15:37:40 UTC