]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/process/test/sub_launcher.cpp
1 // Copyright (c) 2015 Klemens D. Morgenstern
2 // Distributed under the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 #include <boost/process.hpp>
6 #include <boost/program_options.hpp>
19 int main(int argc
, char *argv
[])
22 using namespace boost::program_options
;
23 using namespace boost::process
;
25 bool launch_detached
= false;
26 bool launch_attached
= false;
28 options_description desc
;
30 ("launch-detached", bool_switch(&launch_detached
))
31 ("launch-attached", bool_switch(&launch_attached
))
35 command_line_parser
parser(argc
, argv
);
36 store(parser
.options(desc
).allow_unregistered().run(), vm
);
46 c1
= child(argv
[0], ec
, std_out
> null
, std_err
> null
, std_in
< null
);
50 cerr
<< ec
.message() << endl
;
54 cout
<< c1
.id() << endl
;
63 c2
= child(argv
[0], ec
, g
, std_out
> null
, std_err
> null
, std_in
< null
);
67 cerr
<< ec
.message() << endl
;
71 cout
<< c2
.id() << endl
;
79 this_thread::sleep_for(chrono::seconds(10));