Imported Upstream version 1.64.0
[platform/upstream/boost.git] / libs / process / doc / autodoc.xml
1 <?xml version="1.0" standalone="yes"?>
2 <library-reference><header name="boost/process/args.hpp">
3 <para>This header provides the <globalname alt="boost::process::args">args</globalname> property. It also provides the alternative name <globalname alt="boost::process::argv">argv</globalname> .</para><para> 
4 <programlisting language="c++">
5 namespace boost {
6   namespace process {
7     <emphasis>unspecified</emphasis> <globalname alt="boost::process::args">args</globalname>;
8     <emphasis>unspecified</emphasis> <globalname alt="boost::process::argv">argv</globalname>;
9   }
10 }
11 </programlisting>
12  </para><namespace name="boost">
13 <namespace name="process">
14 <data-member name="args"><type><emphasis>unspecified</emphasis></type><description><para>The <computeroutput>args</computeroutput> property allows to explicitly set arguments for the execution. The name of the executable will always be the first element in the arg-vector.</para><sect1 id="namespaceboost_1_1process_1args_details">
15 <title>Details</title>
16 <sect2 id="namespaceboost_1_1process_1args_operations">
17 <title>Operations</title>
18 <sect3 id="namespaceboost_1_1process_1args_set_var">
19 <title>Setting values</title>
20 <para>To set a the argument vector the following syntax can be used.</para><para><programlisting language="c++">args = value;
21 args(value);
22 </programlisting></para><para><computeroutput>std::initializer_list</computeroutput> is among the allowed types, so the following syntax is also possible.</para><para><programlisting language="c++">args = {value1, value2};
23 args({value1, value2});
24 </programlisting></para><para>Below the possible types for <computeroutput>value</computeroutput> are listed, with <computeroutput>char_type</computeroutput> being either <computeroutput>char</computeroutput> or <computeroutput>wchar_t</computeroutput>.</para><sect4 id="namespaceboost_1_1process_1args_set_var_value">
25 <title>value</title>
26 <para><itemizedlist>
27 <listitem><para><computeroutput>std::basic_string&lt;char_type&gt;</computeroutput></para></listitem><listitem><para><computeroutput>const char_type *</computeroutput></para></listitem><listitem><para><computeroutput>std::initializer_list&lt;const char_type *&gt;</computeroutput></para></listitem><listitem><para><computeroutput>std::vector&lt;std::basic_string&lt;char_type&gt;&gt;</computeroutput></para></listitem></itemizedlist>
28 </para><para>Additionally any range of <computeroutput>std::basic_string&lt;char_type&gt;</computeroutput> can be passed.</para></sect4>
29 </sect3>
30 <sect3 id="namespaceboost_1_1process_1args_append_var">
31 <title>Appending values</title>
32 <para>To append a the argument vector the following syntax can be used.</para><para><programlisting language="c++">args += value;
33 </programlisting></para><para><computeroutput>std::initializer_list</computeroutput> is among the allowed types, so the following syntax is also possible.</para><para><programlisting language="c++">args += {value1, value2};
34 </programlisting></para><para>Below the possible types for <computeroutput>value</computeroutput> are listed, with <computeroutput>char_type</computeroutput> being either <computeroutput>char</computeroutput> or <computeroutput>wchar_t</computeroutput>.</para><sect4 id="namespaceboost_1_1process_1args_append_var_value">
35 <title>value</title>
36 <para><itemizedlist>
37 <listitem><para><computeroutput>std::basic_string&lt;char_type&gt;</computeroutput></para></listitem><listitem><para><computeroutput>const char_type *</computeroutput></para></listitem><listitem><para><computeroutput>std::initializer_list&lt;const char_type *&gt;</computeroutput></para></listitem><listitem><para><computeroutput>std::vector&lt;std::basic_string&lt;char_type&gt;&gt;</computeroutput></para></listitem></itemizedlist>
38 </para><para>Additionally any range of <computeroutput>std::basic_string&lt;char_type&gt;</computeroutput> can be passed.</para></sect4>
39 </sect3>
40 </sect2>
41 <sect2 id="namespaceboost_1_1process_1args_example">
42 <title>Example</title>
43 <para>The overload form is used when more than one string is passed, from the second one forward. I.e. the following expressions have the same results:</para><para><programlisting language="c++">spawn("gcc", "--version");
44 spawn("gcc", args ="--version");
45 spawn("gcc", args+="--version");
46 spawn("gcc", args ={"--version"});
47 spawn("gcc", args+={"--version"});
48 </programlisting></para><para><note><para>A string will be parsed and set in quotes if it has none and contains spaces. </para></note>
49 </para></sect2>
50 </sect1></description></data-member>
51 <data-member name="argv"><type><emphasis>unspecified</emphasis></type><purpose>Alias for <globalname alt="boost::process::args">args</globalname>  . </purpose></data-member>
52
53
54
55
56
57
58
59 </namespace>
60 </namespace>
61 </header>
62 <header name="boost/process/async.hpp">
63 <para>The header which provides the basic asynchrounous features. It provides the on_exit property, which allows callbacks when the process exits. It also implements the necessary traits for passing an boost::asio::io_service, which is needed for asynchronous communication.</para><para>It also pulls the <ulink url="http://www.boost.org/doc/libs/release/doc/html/boost_asio/reference/buffer.html">boost::asio::buffer</ulink> into the boost::process namespace for convenience.</para><para> 
64 <programlisting language="c++">
65 namespace boost {
66   namespace process {
67     <emphasis>unspecified</emphasis> <ulink url="http://www.boost.org/doc/libs/1_61_0/doc/html/boost_asio/reference/buffer.html">buffer</ulink>;
68     <emphasis>unspecified</emphasis> <globalname alt="boost::process::on_exit">on_exit</globalname>;
69   }
70 }
71 </programlisting>
72
73  </para><namespace name="boost">
74 <namespace name="process">
75 <data-member name="on_exit" specifiers="static"><type><emphasis>unspecified</emphasis></type><description><para>When an io_service is passed, the on_exit property can be used, to be notified when the child process exits.</para><para>The following syntax is valid</para><para><programlisting language="c++">on_exit=function;
76 on_exit(function);
77 </programlisting></para><para>with <computeroutput>function</computeroutput> being a callable object with the signature <computeroutput>(int, const std::error_code&amp;)</computeroutput> or an <computeroutput>std::future&lt;int&gt;</computeroutput>.</para><para><formalpara><title>Example</title><para/></formalpara>
78 <programlisting language="c++">io_service ios;
79
80 child c("ls", on_exit=[](int exit, const std::error_code&amp; ec_in){});
81
82 std::future&lt;int&gt; exit_code;
83 chlid c2("ls", on_exit=exit_code);
84 </programlisting></para><para><note><para>The handler is not invoked when the launch fails. </para></note>
85 <warning><para>When used ignore_error it might gte invoked on error. </para></warning>
86 </para></description></data-member>
87
88
89
90
91
92
93
94 </namespace>
95 </namespace>
96 </header>
97 <header name="boost/process/async_pipe.hpp">
98 <namespace name="boost">
99 <namespace name="process">
100 <class name="async_pipe"><description><para>Class implementing and asnychronous I/O-Object for use with boost.asio. It is based on the corresponding I/O Object, that is either boost::asio::windows::stream_handle or boost::asio::posix::stream_descriptor.</para><para>It can be used directly with boost::asio::async_read or async_write.</para><para><note><para>The object is copyable, but that does invoke a handle duplicate. </para></note>
101 </para></description><typedef name="native_handle_type"><description><para>Typedef for the native handle representation. <note><para>This is the handle on the system, not the boost.asio class. </para></note>
102 </para></description><type>platform_specific</type></typedef>
103 <typedef name="handle_type"><description><para>Typedef for the handle representation of boost.asio. </para></description><type>platform_specific</type></typedef>
104 <method-group name="public member functions">
105 <method name="conversion-operator" cv="const" specifiers="explicit"><type>basic_pipe&lt; CharT, Traits &gt;</type><template>
106           <template-type-parameter name="CharT"/>
107           <template-type-parameter name="Traits"><default>std::char_traits&lt;CharT&gt;</default></template-type-parameter>
108         </template><description><para>Explicit cast to <classname alt="boost::process::basic_pipe">basic_pipe</classname>. </para></description></method>
109 <method name="cancel"><type>void</type><description><para>Cancel the current asynchronous operations. </para></description></method>
110 <method name="close"><type>void</type><description><para>Close the pipe handles. </para></description></method>
111 <method name="close"><type>void</type><parameter name="ec"><paramtype>std::error_code &amp;</paramtype></parameter><description><para>Close the pipe handles. While passing an error_code </para></description></method>
112 <method name="is_open" cv="const"><type>bool</type><description><para>Check if the pipes are open. </para></description></method>
113 <method name="async_close"><type>void</type><description><para>Async close, i.e. close after current operation is completed.</para><para><note><para>There is no guarantee that this will indeed read the entire pipe-buffer </para></note>
114 </para></description></method>
115 <method name="read_some"><type>std::size_t</type><template>
116           <template-type-parameter name="MutableBufferSequence"/>
117         </template><parameter name="buffers"><paramtype>const MutableBufferSequence &amp;</paramtype></parameter><description><para>Read some data from the handle.</para><para>See the boost.asio documentation for more details. </para></description></method>
118 <method name="write_some"><type>std::size_t</type><template>
119           <template-type-parameter name="MutableBufferSequence"/>
120         </template><parameter name="buffers"><paramtype>const MutableBufferSequence &amp;</paramtype></parameter><description><para>Write some data to the handle.</para><para>See the boost.asio documentation for more details. </para></description></method>
121 <method name="native_source" cv="const"><type>native_handle</type><description><para>Get the native handle of the source. </para></description></method>
122 <method name="native_sink" cv="const"><type>native_handle</type><description><para>Get the native handle of the sink. </para></description></method>
123 <method name="async_read_some"><type><emphasis>unspecified</emphasis></type><template>
124           <template-type-parameter name="MutableBufferSequence"/>
125           <template-type-parameter name="ReadHandler"/>
126         </template><parameter name="buffers"><paramtype>const MutableBufferSequence &amp;</paramtype></parameter><parameter name="handler"><paramtype>ReadHandler &amp;&amp;</paramtype></parameter><description><para>Start an asynchronous read.</para><para>See the <ulink url="http://www.boost.org/doc/libs/1_60_0/doc/html/boost_asio/reference/AsyncReadStream.html">boost.asio documentation</ulink> for more details. </para></description></method>
127 <method name="async_write_some"><type><emphasis>unspecified</emphasis></type><template>
128           <template-type-parameter name="ConstBufferSequence"/>
129           <template-type-parameter name="WriteHandler"/>
130         </template><parameter name="buffers"><paramtype>const ConstBufferSequence &amp;</paramtype></parameter><parameter name="handler"><paramtype>WriteHandler &amp;&amp;</paramtype></parameter><description><para>Start an asynchronous write.</para><para>See the <ulink url="http://www.boost.org/doc/libs/1_60_0/doc/html/boost_asio/reference/AsyncWriteStream.html">boost.asio documentation</ulink> for more details. </para></description></method>
131 <method name="sink" cv="const"><type>const handle_type &amp;</type><purpose>Get the asio handle of the pipe sink. </purpose></method>
132 <method name="source" cv="const"><type>const handle_type &amp;</type><purpose>Get the asio handle of the pipe source. </purpose></method>
133 <method name="sink"><type>handle_type &amp;&amp;</type><purpose>Get the asio handle of the pipe sink. Qualified as rvalue. </purpose></method>
134 <method name="source"><type>handle_type &amp;&amp;</type><purpose>Get the asio handle of the pipe source. Qualified as rvalue. </purpose></method>
135 <method name="source"><type>handle_type</type><parameter name="ios"><paramtype>::boost::asio::io_service &amp;</paramtype></parameter><purpose>Move the source out of this class and change the io_service. Qualified as rvalue. </purpose><description><para><note><para>Will always move. </para></note>
136 </para></description></method>
137 <method name="sink"><type>handle_type</type><parameter name="ios"><paramtype>::boost::asio::io_service &amp;</paramtype></parameter><purpose>Move the sink out of this class and change the io_service. Qualified as rvalue. </purpose><description><para><note><para>Will always move </para></note>
138 </para></description></method>
139 <method name="source" cv="const"><type>handle_type</type><parameter name="ios"><paramtype>::boost::asio::io_service &amp;</paramtype></parameter><purpose>Copy the source out of this class and change the io_service. </purpose><description><para><note><para>Will always copy. </para></note>
140 </para></description></method>
141 <method name="sink" cv="const"><type>handle_type</type><parameter name="ios"><paramtype>::boost::asio::io_service &amp;</paramtype></parameter><purpose>Copy the sink out of this class and change the io_service. </purpose><description><para><note><para>Will always copy </para></note>
142 </para></description></method>
143 </method-group>
144 <constructor><parameter name="ios"><paramtype>boost::asio::io_service &amp;</paramtype></parameter><description><para>Construct a new <classname alt="boost::process::async_pipe">async_pipe</classname>, does automatically open the pipe. Initializes source and sink with the same io_service. <note><para>Windows creates a named pipe here, where the name is automatically generated. </para></note>
145 </para></description></constructor>
146 <constructor><parameter name="ios_source"><paramtype>boost::asio::io_service &amp;</paramtype></parameter><parameter name="ios_sink"><paramtype>boost::asio::io_service &amp;</paramtype></parameter><description><para>Construct a new <classname alt="boost::process::async_pipe">async_pipe</classname>, does automatically open the pipe. <note><para>Windows creates a named pipe here, where the name is automatically generated. </para></note>
147 </para></description></constructor>
148 <constructor><parameter name="ios"><paramtype>boost::asio::io_service &amp;</paramtype></parameter><parameter name="name"><paramtype>const std::string &amp;</paramtype></parameter><description><para>Construct a new <classname alt="boost::process::async_pipe">async_pipe</classname>, does automatically open. Initializes source and sink with the same io_service.</para><para><note><para>Windows restricts possible names. </para></note>
149 </para></description></constructor>
150 <constructor><parameter name="ios_source"><paramtype>boost::asio::io_service &amp;</paramtype></parameter><parameter name="ios_sink"><paramtype>boost::asio::io_service &amp;</paramtype></parameter><parameter name="name"><paramtype>const std::string &amp;</paramtype></parameter><description><para>Construct a new <classname alt="boost::process::async_pipe">async_pipe</classname>, does automatically open.</para><para><note><para>Windows restricts possible names. </para></note>
151 </para></description></constructor>
152 <constructor><parameter name="lhs"><paramtype>const <classname>async_pipe</classname> &amp;</paramtype></parameter><description><para>Copy-Constructor of the async pipe. <note><para>Windows requires a named pipe for this, if a the wrong type is used an exception is thrown. </para></note>
153 </para></description></constructor>
154 <constructor><parameter name="lhs"><paramtype><classname>async_pipe</classname> &amp;&amp;</paramtype></parameter><description><para>Move-Constructor of the async pipe. </para></description></constructor>
155 <constructor specifiers="explicit"><template>
156           <template-type-parameter name="CharT"/>
157           <template-type-parameter name="Traits"><default>std::char_traits&lt;CharT&gt;</default></template-type-parameter>
158         </template><parameter name="ios"><paramtype>boost::asio::io_service &amp;</paramtype></parameter><parameter name="p"><paramtype>const <classname>basic_pipe</classname>&lt; CharT, Traits &gt; &amp;</paramtype></parameter><description><para>Construct the async-pipe from a pipe. <note><para>Windows requires a named pipe for this, if a the wrong type is used an exception is thrown. </para></note>
159 </para></description></constructor>
160 <constructor specifiers="explicit"><template>
161           <template-type-parameter name="CharT"/>
162           <template-type-parameter name="Traits"><default>std::char_traits&lt;CharT&gt;</default></template-type-parameter>
163         </template><parameter name="ios_source"><paramtype>boost::asio::io_service &amp;</paramtype></parameter><parameter name="ios_sink"><paramtype>boost::asio::io_service &amp;</paramtype></parameter><parameter name="p"><paramtype>const <classname>basic_pipe</classname>&lt; CharT, Traits &gt; &amp;</paramtype></parameter><description><para>Construct the async-pipe from a pipe, with two different io_service objects. <note><para>Windows requires a named pipe for this, if a the wrong type is used an exception is thrown. </para></note>
164 </para></description></constructor>
165 <copy-assignment><type><classname>async_pipe</classname> &amp;</type><template>
166           <template-type-parameter name="CharT"/>
167           <template-type-parameter name="Traits"><default>std::char_traits&lt;CharT&gt;</default></template-type-parameter>
168         </template><parameter name="p"><paramtype>const <classname>basic_pipe</classname>&lt; CharT, Traits &gt; &amp;</paramtype></parameter><description><para>Assign a <classname alt="boost::process::basic_pipe">basic_pipe</classname>. <note><para>Windows requires a named pipe for this, if a the wrong type is used an exception is thrown. </para></note>
169 </para></description></copy-assignment>
170 <copy-assignment><type><classname>async_pipe</classname> &amp;</type><parameter name="lhs"><paramtype>const <classname>async_pipe</classname> &amp;</paramtype></parameter><description><para>Copy Assign a pipe. <note><para>Duplicates the handles. </para></note>
171 </para></description></copy-assignment>
172 <copy-assignment><type><classname>async_pipe</classname> &amp;</type><parameter name="lhs"><paramtype><classname>async_pipe</classname> &amp;&amp;</paramtype></parameter><description><para>Move assign a pipe </para></description></copy-assignment>
173 <destructor><description><para>Destructor. Closes the pipe handles. </para></description></destructor>
174 </class>
175
176
177
178
179
180
181 </namespace>
182 </namespace>
183 </header>
184 <header name="boost/process/async_system.hpp">
185 <para>Defines the asynchrounous version of the system function. </para><namespace name="boost">
186 <namespace name="process">
187 <function name="async_system"><type><emphasis>unspecified</emphasis></type><template>
188           <template-type-parameter name="ExitHandler"/>
189           <template-nontype-parameter name="Args"><type>typename...</type></template-nontype-parameter>
190         </template><parameter name="ios"><paramtype>boost::asio::io_service &amp;</paramtype><description><para>A reference to an <ulink url="http://www.boost.org/doc/libs/release/doc/html/boost_asio/reference.html">io_service</ulink> </para></description></parameter><parameter name="exit_handler"><paramtype>ExitHandler &amp;&amp;</paramtype><description><para>The exit-handler for the signature <computeroutput>void(boost::system::error_code, int)</computeroutput></para></description></parameter><parameter name="args"><paramtype>Args &amp;&amp;...</paramtype></parameter><description><para>This function provides an asynchronous interface to process launching.</para><para>It uses the same properties and parameters as the other launching function, but is similar to the asynchronous functions in <ulink url="http://www.boost.org/doc/libs/release/doc/html/boost_asio.html">boost.asio</ulink></para><para>It uses <ulink url="http://www.boost.org/doc/libs/release/doc/html/boost_asio/reference/async_result.html">asio::async_result</ulink> to determine the return value (from the second parameter, <computeroutput>exit_handler</computeroutput>).</para><para>
191 <note><para>This function does not allow custom error handling, since those are done through the <computeroutput>exit_handler</computeroutput>. </para></note>
192 </para></description></function>
193
194
195
196
197
198
199 </namespace>
200 </namespace>
201 </header>
202 <header name="boost/process/child.hpp">
203 <para>Defines a child process class. </para><namespace name="boost">
204 <namespace name="process">
205 <class name="child"><description><para>The main class to hold a child process. It is simliar to <ulink url="http://en.cppreference.com/w/cpp/thread/thread">std::thread</ulink>, in that it has a join and detach function.</para><para><note><para>The destructor will call terminate on the process if not joined or detached without any warning. </para></note>
206 </para></description><method-group name="private member functions">
207 <method name="detach"><type>void</type><description><para>Detach the child, i.e. let it run after this handle dies. </para></description></method>
208 <method name="join"><type>void</type><description><para>Join the child. This just calls wait, but that way the naming is similar to std::thread </para></description></method>
209 <method name="joinable"><type>bool</type><description><para>Check if the child is joinable. </para></description></method>
210 <method name="native_handle" cv="const"><type>native_handle_t</type><description><para>Get the native handle for the child process. </para></description></method>
211 <method name="exit_code" cv="const"><type>int</type><description><para>Get the exit_code. The return value is without any meaning if the child wasn't waited for or if it was terminated. </para></description></method>
212 <method name="id" cv="const"><type>pid_t</type><description><para>Get the Process Identifier. </para></description></method>
213 <method name="running"><type>bool</type><description><para>Check if the child process is running. </para></description></method>
214 <method name="running" cv="noexcept"><type>bool</type><parameter name="ec"><paramtype>std::error_code &amp;</paramtype></parameter><description><para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para></description></method>
215 <method name="wait"><type>void</type><description><para>Wait for the child process to exit. </para></description></method>
216 <method name="wait" cv="noexcept"><type>void</type><parameter name="ec"><paramtype>std::error_code &amp;</paramtype></parameter><description><para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para></description></method>
217 <method name="wait_for"><type>bool</type><template>
218           <template-type-parameter name="Rep"/>
219           <template-type-parameter name="Period"/>
220         </template><parameter name="rel_time"><paramtype>const std::chrono::duration&lt; Rep, Period &gt; &amp;</paramtype></parameter><description><para>Wait for the child process to exit for a period of time. 
221 </para></description><returns><para>True if child exited while waiting. </para></returns></method>
222 <method name="wait_for" cv="noexcept"><type>bool</type><parameter name="rel_time"><paramtype>const std::chrono::duration&lt; Rep, Period &gt; &amp;</paramtype></parameter><parameter name="ec"><paramtype>std::error_code &amp;</paramtype></parameter><description><para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para></description></method>
223 <method name="wait_until"><type>bool</type><template>
224           <template-type-parameter name="Clock"/>
225           <template-type-parameter name="Duration"/>
226         </template><parameter name="timeout_time"><paramtype>const std::chrono::time_point&lt; Clock, Duration &gt; &amp;</paramtype></parameter><description><para>Wait for the child process to exit until a point in time. 
227 </para></description><returns><para>True if child exited while waiting. </para></returns></method>
228 <method name="wait_until" cv="noexcept"><type>bool</type><parameter name="timeout_time"><paramtype>const std::chrono::time_point&lt; Clock, Duration &gt; &amp;</paramtype></parameter><parameter name="ec"><paramtype>std::error_code &amp;</paramtype></parameter><description><para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para></description></method>
229 <method name="valid" cv="const"><type>bool</type><description><para>Check if this handle holds a child process. <note><para>That does not mean, that the process is still running. It only means, that the handle does or did exist. </para></note>
230 </para></description></method>
231 <method name="conversion-operator" cv="const" specifiers="explicit"><type>bool</type><description><para>Same as valid, for convenience. </para></description></method>
232 <method name="in_group" cv="const"><type>bool</type><description><para>Check if the the chlid process is in any process group. </para></description></method>
233 <method name="in_group" cv="const noexcept"><type>bool</type><parameter name="ec"><paramtype>std::error_code &amp;</paramtype></parameter><description><para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para></description></method>
234 <method name="terminate"><type>void</type><description><para>Terminate the child process.</para><para>This function will cause the child process to unconditionally and immediately exit. It is implement with <ulink url="http://pubs.opengroup.org/onlinepubs/009695399/functions/kill.html">SIGKILL</ulink> on posix and <ulink url="https://technet.microsoft.com/en-us/library/ms686714.aspx">TerminateProcess</ulink> on windows. </para></description></method>
235 <method name="terminate" cv="noexcept"><type>void</type><parameter name="ec"><paramtype>std::error_code &amp;</paramtype></parameter><description><para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para></description></method>
236 </method-group>
237 <constructor specifiers="explicit"><parameter name="pid"><paramtype>pid_t &amp;</paramtype></parameter><description><para>Construct the child from a pid.</para><para><note><para>There is no guarantee that this will work. The process need the right access rights, which are very platform specific. </para></note>
238 </para></description></constructor>
239 <constructor><parameter name="lhs"><paramtype><classname>child</classname> &amp;&amp;</paramtype></parameter><description><para>Move-Constructor. </para></description></constructor>
240 <constructor specifiers="explicit"><template>
241           <template-nontype-parameter name="Args"><type>typename...</type></template-nontype-parameter>
242         </template><parameter name="args"><paramtype>Args &amp;&amp;...</paramtype></parameter><description><para>Construct a child from a property list and launch it The standard version is to create a subprocess, which will spawn the process. </para></description></constructor>
243 <constructor cv="= default"><description><para>Construct an empty child. </para></description></constructor>
244 <copy-assignment><type><classname>child</classname> &amp;</type><parameter name="lhs"><paramtype><classname>child</classname> &amp;&amp;</paramtype></parameter><description><para>Move assign. </para></description></copy-assignment>
245 <destructor><description><para>Destructor. <note><para>Will call terminate (without warning) when the child was neither joined nor detached. </para></note>
246 </para></description></destructor>
247 </class>
248
249
250
251
252
253
254 </namespace>
255 </namespace>
256 </header>
257 <header name="boost/process/cmd.hpp">
258 <para>This header provides the <globalname alt="boost::process::cmd">cmd</globalname> property.</para><para> 
259 <programlisting language="c++">
260 namespace boost {
261   namespace process {
262     <emphasis>unspecified</emphasis> <globalname alt="boost::process::cmd">cmd</globalname>;
263   }
264 }
265 </programlisting>
266  </para><namespace name="boost">
267 <namespace name="process">
268 <data-member name="cmd" specifiers="static"><type><emphasis>unspecified</emphasis></type><description><para>The cmd property allows to explicitly set commands for the execution.</para><para>The overload form applies when only one string is passed to a launching function. The string will be internally parsed and split at spaces.</para><para>The following expressions are valid, with <computeroutput>value</computeroutput> being either a C-String or a <computeroutput>std::basic_string</computeroutput> with <computeroutput>char</computeroutput> or <computeroutput>wchar_t</computeroutput>.</para><para><programlisting language="c++">cmd="value";
269 cmd(value);
270 </programlisting></para><para>The property can only be used for assignments. </para></description></data-member>
271
272
273
274
275
276
277
278 </namespace>
279 </namespace>
280 </header>
281 <header name="boost/process/env.hpp">
282 <para>This header which provides the <computeroutput>env</computeroutput> property. It allows the modification of the environment the child process will run in, in a functional style.</para><para> 
283 <programlisting language="c++">
284 namespace boost {
285   namespace process {
286     <emphasis>unspecified</emphasis> <globalname alt="boost::process::env">env</globalname>;
287   }
288 }
289 </programlisting>
290     </para><para>For additional information see the platform documentations:</para><para><itemizedlist>
291 <listitem><para><ulink url="https://msdn.microsoft.com/en-US/library/windows/desktop/ms682653.aspx">windows</ulink></para></listitem><listitem><para><ulink url="http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html">posix</ulink> </para></listitem></itemizedlist>
292 </para><namespace name="boost">
293 <namespace name="process">
294 <data-member name="env"><type><emphasis>unspecified</emphasis></type><description><para>The <computeroutput>env</computeroutput> property provides a functional way to modify the environment used by the child process. If none is passed the environment is inherited from the father process. Appending means that the environment will be interpreted as a ';' or ':' seperated list as used in <computeroutput>PATH</computeroutput>.</para><para>On both <computeroutput>posix</computeroutput> and <computeroutput>windows</computeroutput> the environment variables can be lists of strings, seperated by ';'. This is typically used for the <computeroutput>PATH</computeroutput> variable.</para><para>By default the environment will be inherited from the launching process, which is also true if environment are modified with this initializer.</para><sect1 id="namespaceboost_1_1process_1env_details">
295 <title>Details</title>
296 <sect2 id="namespaceboost_1_1process_1env_operations">
297 <title>Operations</title>
298 <sect3 id="namespaceboost_1_1process_1env_set_var">
299 <title>Setting variables</title>
300 <para>To set a variable <computeroutput>id</computeroutput> the value <computeroutput>value</computeroutput> the following syntax can be used.</para><para><programlisting language="c++">env[id] = value;
301 env(id, value);
302 </programlisting></para><para><computeroutput>std::initializer_list</computeroutput> is among the allowed types, so the following syntax is also possible.</para><para><programlisting language="c++">env[id] = {value1, value2};
303 env(id, {value1, value2});
304 </programlisting></para><para><note><para>Creates the variable if it does not exist.</para></note>
305 The following lists contain possible value types, with <computeroutput>char_type</computeroutput> being either <computeroutput>char</computeroutput> or <computeroutput>wchar_t</computeroutput> for both <computeroutput>id</computeroutput> and <computeroutput>value</computeroutput>.</para><sect4 id="namespaceboost_1_1process_1id">
306 <title>id</title>
307 <para><itemizedlist>
308 <listitem><para><computeroutput>std::basic_string&lt;char_type&gt;</computeroutput></para></listitem><listitem><para><computeroutput>const char_type *</computeroutput></para></listitem></itemizedlist>
309 </para></sect4>
310 <sect4 id="namespaceboost_1_1process_1env_set_var_value">
311 <title>value</title>
312 <para><itemizedlist>
313 <listitem><para><computeroutput>std::basic_string&lt;char_type&gt;</computeroutput></para></listitem><listitem><para><computeroutput>const char_type *</computeroutput></para></listitem><listitem><para><computeroutput>std::initializer_list&lt;const char_type *&gt;</computeroutput></para></listitem><listitem><para><computeroutput>std::vector&lt;std::basic_string&lt;char_type&gt;&gt;</computeroutput></para></listitem></itemizedlist>
314 </para><para><note><para>Using <computeroutput>std::vector</computeroutput> or <computeroutput>std::initializer_list</computeroutput></para></note>
315 </para></sect4>
316 </sect3>
317 <sect3 id="namespaceboost_1_1process_1env_append_var">
318 <title>Append variables</title>
319 <para>Appending means, that a variable will be interpreted as a To append a variable <computeroutput>id</computeroutput> the value <computeroutput>value</computeroutput> the following syntax can be used:</para><para><programlisting language="c++">env[id] += value;
320 </programlisting></para><para><computeroutput>std::initializer_list</computeroutput> is among the allowed types, so the following syntax is also possible.</para><para><programlisting language="c++">env[id] += {value1, value2};
321 </programlisting></para><para><note><para>Creates the variable if it does not exist.</para></note>
322 The following lists contain possible value types, with <computeroutput>char_type</computeroutput> being either <computeroutput>char</computeroutput> or <computeroutput>wchar_t</computeroutput> for both <computeroutput>id</computeroutput> and <computeroutput>value</computeroutput>.</para><sect4 id="namespaceboost_1_1process_1env_append_var_id">
323 <title>id</title>
324 <para><itemizedlist>
325 <listitem><para><computeroutput>std::basic_string&lt;char_type&gt;</computeroutput></para></listitem><listitem><para><computeroutput>const char_type *</computeroutput></para></listitem></itemizedlist>
326 </para></sect4>
327 <sect4 id="namespaceboost_1_1process_1env_append_var_value">
328 <title>value</title>
329 <para><itemizedlist>
330 <listitem><para><computeroutput>std::basic_string&lt;char_type&gt;</computeroutput></para></listitem><listitem><para><computeroutput>const char_type *</computeroutput></para></listitem><listitem><para><computeroutput>std::initializer_list&lt;const char_type *&gt;</computeroutput></para></listitem><listitem><para><computeroutput>std::vector&lt;std::basic_string&lt;char_type&gt;&gt;</computeroutput></para></listitem></itemizedlist>
331 </para></sect4>
332 </sect3>
333 <sect3 id="namespaceboost_1_1process_1env_reset">
334 <title>Reset variables</title>
335 <para>Reseting signle variables can be done in the following way:</para><para><programlisting language="c++">env[id] = boost::none;
336 env(id, boost::none);
337 </programlisting></para><para><note><para>This does not set the value empty, but removes it from the list.</para></note>
338 The following lists contain possible value types, with <computeroutput>char_type</computeroutput> being either <computeroutput>char</computeroutput> or <computeroutput>wchar_t</computeroutput>:</para><sect4 id="namespaceboost_1_1process_1env_reset_var_id">
339 <title>id</title>
340 <para><itemizedlist>
341 <listitem><para><computeroutput>std::basic_string&lt;char_type&gt;</computeroutput></para></listitem><listitem><para><computeroutput>const char_type *</computeroutput></para></listitem></itemizedlist>
342 </para></sect4>
343 </sect3>
344 <sect3 id="namespaceboost_1_1process_1env_init">
345 <title>Initialize the environment</title>
346 <para>The whole environment can be initialized from an object of type  <classname>boost::process::environment</classname> </para><para><programlisting language="c++">env=env;
347 env(env);
348 </programlisting></para><para><note><para>The passed <computeroutput>environment</computeroutput> can also be default-constructed to get an empty environment.</para></note>
349 </para><sect4 id="namespaceboost_1_1process_1env_init_var_id">
350 <title>id</title>
351 <para><itemizedlist>
352 <listitem><para><computeroutput>std::basic_string&lt;char_type&gt;</computeroutput></para></listitem><listitem><para><computeroutput>const char_type *</computeroutput></para></listitem></itemizedlist>
353 </para></sect4>
354 <sect4 id="namespaceboost_1_1process_1env_init_var_value">
355 <title>value</title>
356 <para><itemizedlist>
357 <listitem><para><computeroutput><classname alt="boost::process::basic_environment">boost::process::basic_environment</classname>&lt;char_type&gt;</computeroutput></para></listitem></itemizedlist>
358 </para></sect4>
359 </sect3>
360 </sect2>
361 <sect2 id="namespaceboost_1_1process_1env_example">
362 <title>Example</title>
363 <para><programlisting language="c++">spawn("b2", env["PATH"]+="F:/boost", env["SOME_VAR"]=boost::none, env["NEW_VAR"]="VALUE");
364 </programlisting></para><para>If the overload style should be done by passing an instance of  <classname>boost::process::environment</classname>  the above example would look like this.</para><para><programlisting language="c++">environment e = this_process::environment();
365 e["PATH"]   += "F:/boost";
366 e.erase("SOME_VAR");
367 e["NEW_VAR"] = "VALUE";
368 spawn("b2", e);
369 </programlisting></para><para><warning><para>Passing an empty environment will cause undefined behaviour. </para></warning>
370 </para></sect2>
371 </sect1></description></data-member>
372
373
374
375
376
377
378
379 </namespace>
380 </namespace>
381 </header>
382 <header name="boost/process/environment.hpp">
383 <namespace name="boost">
384 <namespace name="process">
385 <class name="basic_environment"><template>
386       <template-type-parameter name="Char"/>
387     </template><purpose>Type definition to hold a seperate environment. </purpose><description><para>Template representation of environments. It takes a character type (<computeroutput>char</computeroutput> or <computeroutput>wchar_t</computeroutput>) as template parameter to implement the environment </para></description><struct name="const_entry_type"><template>
388       <template-type-parameter name="Char"/>
389       <template-type-parameter name="Environment"/>
390     </template><description><para>Proxy class used for read access to members by [] or .at() <note><para>Holds a reference to the environment it was created from. </para></note>
391 </para></description><typedef name="value_type"><type>Char</type></typedef>
392 <typedef name="pointer"><type>const value_type *</type></typedef>
393 <typedef name="string_type"><type>std::basic_string&lt; value_type &gt;</type></typedef>
394 <typedef name="range"><type>boost::iterator_range&lt; pointer &gt;</type></typedef>
395 <typedef name="environment_t"><type>Environment</type></typedef>
396 <method-group name="public member functions">
397 <method name="to_vector" cv="const"><type>std::vector&lt; string_type &gt;</type><purpose>Split the entry by ";" or ":" and return it as a vector. Used by PATH. </purpose><description><para>Get the value as string. Get the name of this entry. </para></description></method>
398 <method name="const_entry" cv="= default"><type/><parameter name=""><paramtype>const const_entry &amp;</paramtype></parameter><purpose>Copy Constructor. </purpose></method>
399 <method name="empty" cv="const"><type>bool</type><purpose>Check if the entry is empty. </purpose></method>
400 </method-group>
401 <copy-assignment cv="= default"><type>const_entry &amp;</type><parameter name=""><paramtype>const const_entry &amp;</paramtype></parameter><purpose>Move Constructor. </purpose></copy-assignment>
402 </struct><struct name="entry_type"><template>
403       <template-type-parameter name="Char"/>
404       <template-type-parameter name="Environment"/>
405     </template><description><para>Proxy class used for read and write access to members by [] or .at() <note><para>Holds a reference to the environment it was created from. </para></note>
406 </para></description><typedef name="value_type"><type>Char</type></typedef>
407 <typedef name="pointer"><type>const value_type *</type></typedef>
408 <typedef name="string_type"><type>std::basic_string&lt; value_type &gt;</type></typedef>
409 <typedef name="range"><type>boost::iterator_range&lt; pointer &gt;</type></typedef>
410 <typedef name="environment_t"><type>Environment</type></typedef>
411 <method-group name="public member functions">
412 <method name="to_vector" cv="const"><type>std::vector&lt; string_type &gt;</type><purpose>Split the entry by ";" or ":" and return it as a vector. Used by PATH. </purpose><description><para>Get the value as string. Get the name of this entry. </para></description></method>
413 <method name="entry" cv="= default"><type/><parameter name=""><paramtype>const entry &amp;</paramtype></parameter><purpose>Copy Constructor. </purpose></method>
414 <method name="empty" cv="const"><type>bool</type><purpose>Check if the entry is empty. </purpose></method>
415 <method name="assign"><type>void</type><parameter name="value"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Assign a string to the value. </purpose></method>
416 <method name="assign"><type>void</type><parameter name="value"><paramtype>const std::vector&lt; string_type &gt; &amp;</paramtype></parameter><purpose>Assign a set of strings to the entry; they will be seperated by ';' or ':'. </purpose></method>
417 <method name="append"><type>void</type><parameter name="value"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Append a string to the end of the entry, it will seperated by ';' or ':'. </purpose></method>
418 <method name="clear"><type>void</type><purpose>Reset the value. </purpose></method>
419 <method name="operator+="><type>entry &amp;</type><parameter name="value"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Append a string to the end of the entry, it will seperated by ';' or ':'. </purpose></method>
420 </method-group>
421 <copy-assignment cv="= default"><type>entry &amp;</type><parameter name=""><paramtype>const entry &amp;</paramtype></parameter><purpose>Move Constructor. </purpose></copy-assignment>
422 <copy-assignment><type>entry &amp;</type><parameter name="value"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Assign a string to the entry. </purpose></copy-assignment>
423 <copy-assignment><type>entry &amp;</type><parameter name="value"><paramtype>const std::vector&lt; string_type &gt; &amp;</paramtype></parameter><purpose>Assign a set of strings to the entry; they will be seperated by ';' or ':'. </purpose></copy-assignment>
424 </struct><typedef name="string_type"><type>std::basic_string&lt; Char &gt;</type></typedef>
425 <typedef name="iterator"><type>boost::transform_iterator&lt; entry_maker, Char ** &gt;</type></typedef>
426 <typedef name="const_iterator"><type>boost::transform_iterator&lt; const_entry_maker, Char ** &gt;</type></typedef>
427 <typedef name="size_type"><type>std::size_t</type></typedef>
428 <typedef name="native_handle"><type><emphasis>unspecified</emphasis></type></typedef>
429 <typedef name="base_type"><type><emphasis>unspecified</emphasis></type></typedef>
430 <method-group name="public member functions">
431 <method name="begin"><type>iterator</type><purpose>Returns an iterator to the beginning. </purpose></method>
432 <method name="begin" cv="const"><type>const_iterator</type><purpose>Returns an iterator to the beginning. </purpose></method>
433 <method name="cbegin" cv="const"><type>const_iterator</type><purpose>Returns an iterator to the beginning. </purpose></method>
434 <method name="end"><type>iterator</type><purpose>Returns an iterator to the end. </purpose></method>
435 <method name="end" cv="const"><type>const_iterator</type><purpose>Returns an iterator to the end. </purpose></method>
436 <method name="cend" cv="const"><type>const_iterator</type><purpose>Returns an iterator to the end. </purpose></method>
437 <method name="find"><type>iterator</type><parameter name="key"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Find a variable by its name. </purpose></method>
438 <method name="find" cv="const"><type>const_iterator</type><parameter name="key"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Find a variable by its name. </purpose></method>
439 <method name="count" cv="const"><type>std::size_t</type><parameter name="st"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Number of variables. </purpose></method>
440 <method name="erase"><type>void</type><parameter name="id"><paramtype>const string_type &amp;</paramtype></parameter><description><para>Erase variable by id. </para></description></method>
441 <method name="emplace"><type>std::pair&lt; iterator, bool &gt;</type><parameter name="id"><paramtype>const string_type &amp;</paramtype></parameter><parameter name="value"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Emplace an environment variable. </purpose></method>
442 <method name="empty"><type>bool</type><purpose>Check if environment has entries. </purpose></method>
443 <method name="size" cv="const"><type>std::size_t</type><purpose>Get the number of variables. </purpose></method>
444 <method name="clear"><type>void</type><purpose>Clear the environment. </purpose><description><para><note><para>Use with care, passed environment cannot be empty. </para></note>
445 </para></description></method>
446 <method name="at"><type><classname>entry_type</classname></type><parameter name="key"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Get the entry with the key. Throws if it does not exist. </purpose></method>
447 <method name="at" cv="const"><type><classname>const_entry_type</classname></type><parameter name="key"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Get the entry with the key. Throws if it does not exist. </purpose></method>
448 <method name="operator[]"><type><classname>entry_type</classname></type><parameter name="key"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Get the entry with the given key. It creates the entry if it doesn't exist. </purpose></method>
449 </method-group>
450 <constructor><purpose>Default constructor. </purpose></constructor>
451 <constructor><parameter name=""><paramtype>const <classname>basic_environment</classname> &amp;</paramtype></parameter><purpose>Copy constructor. </purpose></constructor>
452 <constructor><parameter name=""><paramtype><classname>basic_environment</classname> &amp;&amp;</paramtype></parameter><purpose>Move constructor. </purpose></constructor>
453 <copy-assignment><type><classname>basic_environment</classname> &amp;</type><parameter name=""><paramtype>const <classname>basic_environment</classname> &amp;</paramtype></parameter><purpose>Copy assignment. </purpose></copy-assignment>
454 <copy-assignment><type><classname>basic_environment</classname> &amp;</type><parameter name=""><paramtype><classname>basic_environment</classname> &amp;&amp;</paramtype></parameter><purpose>Move assignment. </purpose></copy-assignment>
455 </class><class name="basic_native_environment"><template>
456       <template-type-parameter name="Char"/>
457     </template><purpose>Definition of the environment for the current process. </purpose><description><para>Template representation of the environment of this process. It takes a template as template parameter to implement the environment. All instances of this class refer to the same environment, but might not get updated if another one makes changes. </para></description><struct name="const_entry_type"><template>
458       <template-type-parameter name="Char"/>
459       <template-type-parameter name="Environment"/>
460     </template><description><para>Proxy class used for read access to members by [] or .at() <note><para>Holds a reference to the environment it was created from. </para></note>
461 </para></description><typedef name="value_type"><type>Char</type></typedef>
462 <typedef name="pointer"><type>const value_type *</type></typedef>
463 <typedef name="string_type"><type>std::basic_string&lt; value_type &gt;</type></typedef>
464 <typedef name="range"><type>boost::iterator_range&lt; pointer &gt;</type></typedef>
465 <typedef name="environment_t"><type>Environment</type></typedef>
466 <method-group name="public member functions">
467 <method name="to_vector" cv="const"><type>std::vector&lt; string_type &gt;</type><purpose>Split the entry by ";" or ":" and return it as a vector. Used by PATH. </purpose><description><para>Get the value as string. Get the name of this entry. </para></description></method>
468 <method name="const_entry" cv="= default"><type/><parameter name=""><paramtype>const const_entry &amp;</paramtype></parameter><purpose>Copy Constructor. </purpose></method>
469 <method name="empty" cv="const"><type>bool</type><purpose>Check if the entry is empty. </purpose></method>
470 </method-group>
471 <copy-assignment cv="= default"><type>const_entry &amp;</type><parameter name=""><paramtype>const const_entry &amp;</paramtype></parameter><purpose>Move Constructor. </purpose></copy-assignment>
472 </struct><struct name="entry_type"><template>
473       <template-type-parameter name="Char"/>
474       <template-type-parameter name="Environment"/>
475     </template><description><para>Proxy class used for read and write access to members by [] or .at() <note><para>Holds a reference to the environment it was created from. </para></note>
476 </para></description><typedef name="value_type"><type>Char</type></typedef>
477 <typedef name="pointer"><type>const value_type *</type></typedef>
478 <typedef name="string_type"><type>std::basic_string&lt; value_type &gt;</type></typedef>
479 <typedef name="range"><type>boost::iterator_range&lt; pointer &gt;</type></typedef>
480 <typedef name="environment_t"><type>Environment</type></typedef>
481 <method-group name="public member functions">
482 <method name="to_vector" cv="const"><type>std::vector&lt; string_type &gt;</type><purpose>Split the entry by ";" or ":" and return it as a vector. Used by PATH. </purpose><description><para>Get the value as string. Get the name of this entry. </para></description></method>
483 <method name="entry" cv="= default"><type/><parameter name=""><paramtype>const entry &amp;</paramtype></parameter><purpose>Copy Constructor. </purpose></method>
484 <method name="empty" cv="const"><type>bool</type><purpose>Check if the entry is empty. </purpose></method>
485 <method name="assign"><type>void</type><parameter name="value"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Assign a string to the value. </purpose></method>
486 <method name="assign"><type>void</type><parameter name="value"><paramtype>const std::vector&lt; string_type &gt; &amp;</paramtype></parameter><purpose>Assign a set of strings to the entry; they will be seperated by ';' or ':'. </purpose></method>
487 <method name="append"><type>void</type><parameter name="value"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Append a string to the end of the entry, it will seperated by ';' or ':'. </purpose></method>
488 <method name="clear"><type>void</type><purpose>Reset the value. </purpose></method>
489 <method name="operator+="><type>entry &amp;</type><parameter name="value"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Append a string to the end of the entry, it will seperated by ';' or ':'. </purpose></method>
490 </method-group>
491 <copy-assignment cv="= default"><type>entry &amp;</type><parameter name=""><paramtype>const entry &amp;</paramtype></parameter><purpose>Move Constructor. </purpose></copy-assignment>
492 <copy-assignment><type>entry &amp;</type><parameter name="value"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Assign a string to the entry. </purpose></copy-assignment>
493 <copy-assignment><type>entry &amp;</type><parameter name="value"><paramtype>const std::vector&lt; string_type &gt; &amp;</paramtype></parameter><purpose>Assign a set of strings to the entry; they will be seperated by ';' or ':'. </purpose></copy-assignment>
494 </struct><typedef name="string_type"><type>std::basic_string&lt; Char &gt;</type></typedef>
495 <typedef name="iterator"><type>boost::transform_iterator&lt; entry_maker, Char ** &gt;</type></typedef>
496 <typedef name="const_iterator"><type>boost::transform_iterator&lt; const_entry_maker, Char ** &gt;</type></typedef>
497 <typedef name="size_type"><type>std::size_t</type></typedef>
498 <typedef name="native_handle"><type><emphasis>unspecified</emphasis></type></typedef>
499 <typedef name="base_type"><type><emphasis>unspecified</emphasis></type></typedef>
500 <method-group name="public member functions">
501 <method name="begin"><type>iterator</type><purpose>Returns an iterator to the beginning. </purpose></method>
502 <method name="begin" cv="const"><type>const_iterator</type><purpose>Returns an iterator to the beginning. </purpose></method>
503 <method name="cbegin" cv="const"><type>const_iterator</type><purpose>Returns an iterator to the beginning. </purpose></method>
504 <method name="end"><type>iterator</type><purpose>Returns an iterator to the end. </purpose></method>
505 <method name="end" cv="const"><type>const_iterator</type><purpose>Returns an iterator to the end. </purpose></method>
506 <method name="cend" cv="const"><type>const_iterator</type><purpose>Returns an iterator to the end. </purpose></method>
507 <method name="find"><type>iterator</type><parameter name="key"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Find a variable by its name. </purpose></method>
508 <method name="find" cv="const"><type>const_iterator</type><parameter name="key"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Find a variable by its name. </purpose></method>
509 <method name="count" cv="const"><type>std::size_t</type><parameter name="st"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Number of variables. </purpose></method>
510 <method name="erase"><type>void</type><parameter name="id"><paramtype>const string_type &amp;</paramtype></parameter><description><para>Erase variable by id. </para></description></method>
511 <method name="emplace"><type>std::pair&lt; iterator, bool &gt;</type><parameter name="id"><paramtype>const string_type &amp;</paramtype></parameter><parameter name="value"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Emplace an environment variable. </purpose></method>
512 <method name="empty"><type>bool</type><purpose>Check if environment has entries. </purpose></method>
513 <method name="size" cv="const"><type>std::size_t</type><purpose>Get the number of variables. </purpose></method>
514 <method name="at"><type><classname>entry_type</classname></type><parameter name="key"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Get the entry with the key. Throws if it does not exist. </purpose></method>
515 <method name="at" cv="const"><type><classname>const_entry_type</classname></type><parameter name="key"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Get the entry with the key. Throws if it does not exist. </purpose></method>
516 <method name="operator[]"><type><classname>entry_type</classname></type><parameter name="key"><paramtype>const string_type &amp;</paramtype></parameter><purpose>Get the entry with the given key. It creates the entry if it doesn't exist. </purpose></method>
517 </method-group>
518 <constructor><purpose>Default constructor. </purpose></constructor>
519 <constructor><parameter name=""><paramtype><classname>basic_native_environment</classname> &amp;&amp;</paramtype></parameter><purpose>Move constructor. </purpose></constructor>
520 <copy-assignment><type><classname>basic_native_environment</classname> &amp;</type><parameter name=""><paramtype><classname>basic_native_environment</classname> &amp;&amp;</paramtype></parameter><purpose>Move assignment. </purpose></copy-assignment>
521 </class><typedef name="native_environment"><purpose>Definition of the environment for the current process. </purpose><type><classname>basic_native_environment</classname>&lt; char &gt;</type></typedef>
522 <typedef name="wnative_environment"><purpose>Definition of the environment for the current process. </purpose><type><classname>basic_native_environment</classname>&lt; wchar_t &gt;</type></typedef>
523 <typedef name="environment"><purpose>Type definition to hold a seperate environment. </purpose><type><classname>basic_environment</classname>&lt; char &gt;</type></typedef>
524 <typedef name="wenvironment"><purpose>Type definition to hold a seperate environment. </purpose><type><classname>basic_environment</classname>&lt; wchar_t &gt;</type></typedef>
525
526
527
528
529
530
531
532 </namespace>
533 <namespace name="this_process">
534 <typedef name="native_handle_type"><purpose>Definition of the native handle type. </purpose><type><emphasis>unspecified</emphasis></type></typedef>
535 <function name="get_id"><type>int</type><purpose>Get the process id of the current process. </purpose></function>
536 <function name="native_handle"><type>native_handle_type</type><purpose>Get the native handle of the current process. </purpose></function>
537 <function name="environment"><type>native_environment</type><purpose>Get the enviroment of the current process. </purpose></function>
538 <function name="wenvironment"><type>wnative_environment</type><purpose>Get the enviroment of the current process. </purpose></function>
539 <function name="path"><type>std::vector&lt; boost::filesystem::path &gt;</type><purpose>Get the path environment variable of the current process runs. </purpose></function>
540 </namespace>
541 </namespace>
542 </header>
543 <header name="boost/process/error.hpp">
544 <para>Header which provides the error properties. It allows to explicitly set the error handling, the properties are:</para><para> 
545 <programlisting language="c++">
546 namespace boost {
547   namespace process {
548     <emphasis>unspecified</emphasis> <globalname alt="boost::process::ignore_error">ignore_error</globalname>;
549     <emphasis>unspecified</emphasis> <globalname alt="boost::process::throw_on_error">throw_on_error</globalname>;
550     <emphasis>unspecified</emphasis> <globalname alt="boost::process::error">error</globalname>;
551     <emphasis>unspecified</emphasis> <globalname alt="boost::process::error_ref">error_ref</globalname>;
552     <emphasis>unspecified</emphasis> <globalname alt="boost::process::error_code">error_code</globalname>;
553   }
554 }
555 </programlisting>
556  For error there are two aliases: error_ref and error_code </para><namespace name="boost">
557 <namespace name="process">
558 <data-member name="ignore_error"><type><emphasis>unspecified</emphasis></type><description><para>The ignore_error property will disable any error handling. This can be useful on linux, where error handling will require a pipe. </para></description></data-member>
559 <data-member name="throw_on_error"><type><emphasis>unspecified</emphasis></type><description><para>The throw_on_error property will enable the exception when launching a process. It is unnecessary by default, but may be used, when an additional error_code is provided. </para></description></data-member>
560 <data-member name="error"><type><emphasis>unspecified</emphasis></type><description><para>The error property will set the executor to handle any errors by setting an <ulink url="http://en.cppreference.com/w/cpp/error/error_code">std::error_code</ulink>.</para><para><programlisting language="c++">std::error_code ec;
561 system("gcc", error(ec));
562 </programlisting></para><para>The following syntax is valid:</para><para><programlisting language="c++">error(ec);
563 error=ec;
564 </programlisting></para><para>The overload version is achieved by just passing an object of <ulink url="http://en.cppreference.com/w/cpp/error/error_code">std::error_code</ulink> to the function. </para></description></data-member>
565 <data-member name="error_ref"><type><emphasis>unspecified</emphasis></type><purpose>Alias for <globalname alt="boost::process::error">error</globalname>  . </purpose></data-member>
566 <data-member name="error_code"><type><emphasis>unspecified</emphasis></type><purpose>Alias for <globalname alt="boost::process::error">error</globalname>  . </purpose></data-member>
567
568
569
570
571
572
573
574 </namespace>
575 </namespace>
576 </header>
577 <header name="boost/process/exception.hpp">
578 <namespace name="boost">
579 <namespace name="process">
580 <struct name="process_error"><inherit access="public">system_error</inherit><purpose>The exception usually thrown by boost.process. </purpose><description><para>It merely inherits <ulink url="http://en.cppreference.com/w/cpp/error/system_error">std::system_error</ulink> but can then be distinguished in the catch-block from other system errors. </para></description></struct>
581
582
583
584
585
586
587 </namespace>
588 </namespace>
589 </header>
590 <header name="boost/process/exe.hpp">
591 <para>Header which provides the exe property.  
592 <programlisting language="c++">
593 namespace boost {
594   namespace process {
595     <emphasis>unspecified</emphasis> <globalname alt="boost::process::exe">exe</globalname>;
596   }
597 }
598 </programlisting>
599  </para><namespace name="boost">
600 <namespace name="process">
601 <data-member name="exe"><type><emphasis>unspecified</emphasis></type><description><para>The exe property allows to explicitly set the executable.</para><para>The overload form applies when to the first, when several strings are passed to a launching function.</para><para>The following expressions are valid, with <computeroutput>value</computeroutput> being either a C-String or a <computeroutput>std::basic_string</computeroutput> with <computeroutput>char</computeroutput> or <computeroutput>wchar_t</computeroutput> or a <computeroutput>boost::filesystem::path</computeroutput>.</para><para><programlisting language="c++">exe="value";
602 exe(value);
603 </programlisting></para><para>The property can only be used for assignments. </para></description></data-member>
604
605
606
607
608
609
610
611 </namespace>
612 </namespace>
613 </header>
614 <header name="boost/process/extend.hpp">
615 <para>This header which provides the types and functions provided for custom extensions.</para><para> 
616 Please refer to the <link linkend="boost_process.extend">tutorial</link> for more details.
617  </para><namespace name="boost">
618 <namespace name="process">
619 <namespace name="extend">
620 <struct name="handler"><description><para>This class is the base for every initializer, to be used for extensions.</para><para>The usage is done through compile-time polymorphism, so that the required functions can be overloaded.</para><para><note><para>None of the function need to be <computeroutput>const</computeroutput>. </para></note>
621 </para></description><method-group name="public member functions">
622 <method name="on_setup" cv="const"><type>void</type><template>
623           <template-type-parameter name="Executor"/>
624         </template><parameter name=""><paramtype>Executor &amp;</paramtype></parameter><purpose>This function is invoked before the process launch. </purpose><description><para><note><para>It is not required to be const. </para></note>
625 </para></description></method>
626 <method name="on_error" cv="const"><type>void</type><template>
627           <template-type-parameter name="Executor"/>
628         </template><parameter name=""><paramtype>Executor &amp;</paramtype></parameter><parameter name=""><paramtype>const std::error_code &amp;</paramtype></parameter><description><para>This function is invoked if an error occured while trying to launch the process. <note><para>It is not required to be const. </para></note>
629 </para></description></method>
630 <method name="on_success" cv="const"><type>void</type><template>
631           <template-type-parameter name="Executor"/>
632         </template><parameter name=""><paramtype>Executor &amp;</paramtype></parameter><description><para>This function is invoked if the process was successfully launched. <note><para>It is not required to be const. </para></note>
633 </para></description></method>
634 <method name="on_fork_error" cv="const"><type>void</type><template>
635           <template-type-parameter name="Executor"/>
636         </template><parameter name=""><paramtype>Executor &amp;</paramtype></parameter><parameter name=""><paramtype>const std::error_code &amp;</paramtype></parameter><description><para>This function is invoked if an error occured during the call of <computeroutput>fork</computeroutput>. <note><para>This function will only be called on posix. </para></note>
637 </para></description></method>
638 <method name="on_exec_setup" cv="const"><type>void</type><template>
639           <template-type-parameter name="Executor"/>
640         </template><parameter name=""><paramtype>Executor &amp;</paramtype></parameter><description><para>This function is invoked if the call of <computeroutput>fork</computeroutput> was successful, before calling <computeroutput>execve</computeroutput>. <note><para>This function will only be called on posix. </para></note>
641 <note><para>It will be invoked from the new process. </para></note>
642 </para></description></method>
643 <method name="on_exec_error" cv="const"><type>void</type><template>
644           <template-type-parameter name="Executor"/>
645         </template><parameter name=""><paramtype>Executor &amp;</paramtype></parameter><parameter name=""><paramtype>const std::error_code &amp;</paramtype></parameter><description><para>This function is invoked if the call of <computeroutput>execve</computeroutput> failed. <note><para>This function will only be called on posix. </para></note>
646 <note><para>It will be invoked from the new process. </para></note>
647 </para></description></method>
648 </method-group>
649 </struct><struct name="require_io_service"><description><para>Inheriting the class will tell the launching process that an <computeroutput>io_service</computeroutput> is needed. This should always be used when get_io_service is used. </para></description></struct><struct name="async_handler"><inherit access="public">boost::process::extend::handler</inherit><inherit access="public">boost::process::extend::require_io_service</inherit><description><para>Inheriting this class will tell the launching function, that an event handler shall be invoked when the process exits. This automatically does also inherit <classname alt="boost::process::extend::require_io_service">require_io_service</classname>.</para><para>You must add the following function to your implementation:</para><para><programlisting language="c++">template&lt;typename Executor&gt;
650 std::function&lt;void(int, const std::error_code&amp;)&gt; on_exit_handler(Executor &amp; exec)
651 {
652     auto handler = this-&gt;handler;
653     return [handler](int exit_code, const std::error_code &amp; ec)
654            {
655                 handler(static_cast&lt;int&gt;(exit_code), ec);
656            };
657
658 }
659 </programlisting></para><para>The callback will be obtained by calling this function on setup and it will be invoked when the process exits.</para><para><warning><para>Cannot be used with boost::process::spawn </para></warning>
660 </para></description></struct><struct name="posix_executor"><template>
661       <template-type-parameter name="Sequence"><purpose><para>The used initializer-sequence, it is fulfills the boost.fusion <ulink url="http://www.boost.org/doc/libs/master/libs/fusion/doc/html/fusion/sequence.html">sequence</ulink> concept.</para></purpose></template-type-parameter>
662     </template><purpose>The posix executor type. </purpose><description><para>This type represents the posix executor and can be used for overloading in a custom handler. <note><para>It is an alias for the implementation on posix, and a forward-declaration on windows.</para></note>
663
664  
665 As information for extension development, here is the structure of the process launching (in pseudo-code and uml)
666 <programlisting language="c++">
667 for (auto &amp; s : seq)
668     s.<methodname alt="boost::process::extend::handler::on_setup">on_setup</methodname>(*this);
669
670 if (<methodname alt="boost::process::extend::posix_executor::error">error</methodname>())
671 {
672     for (auto &amp; s : seq)
673        s.<methodname alt="boost::process::extend::handler::on_error">on_error</methodname>(*this, <methodname alt="boost::process::extend::posix_executor::error">error</methodname>());
674     return <classname alt="boost::process::child">child</classname>();
675 }
676
677 pid = <ulink url="http://pubs.opengroup.org/onlinepubs/009695399/functions/fork.html">fork()</ulink>
678 <methodname alt="boost::process::extend::handler::on_setup">on_setup</methodname>(*this);
679
680 if (pid == -1) //fork error 
681 {
682     <methodname alt="boost::process::extend::posix_executor::set_error">set_error</methodname>(<functionname alt="boost::process::extend::get_last_error">get_last_error</functionname>());
683     for (auto &amp; s : seq)
684         s.<methodname alt="boost::process::extend::handler::on_fork_error">on_fork_error</methodname>(*this, <methodname alt="boost::process::extend::posix_executor::error">error</methodname>());
685     for (auto &amp; s : seq)
686         s.<methodname alt="boost::process::extend::handler::on_error">on_error</methodname>(*this, <methodname alt="boost::process::extend::posix_executor::error">error</methodname>());
687     return <classname alt="boost::process::child">child</classname>()
688 }
689 else if (pid == 0) //child process
690 {
691     for (auto &amp; s : seq)
692         s.<methodname alt="boost::process::extend::handler::on_exec_setup">on_exec_setup</methodname>(*this);
693     <ulink url="http://pubs.opengroup.org/onlinepubs/009695399/functions/exec.html">execve</ulink>(exe, cmd_line, env);
694     auto ec = <functionname alt="boost::process::extend::get_last_error">get_last_error</functionname>();
695     for (auto &amp; s : seq)
696         s.<methodname alt="boost::process::extend::handler::on_exec_error">on_exec_error</methodname>(*this);
697
698     <emphasis>unspecified();</emphasis>//here the error is send to the father process interally
699
700     <ulink url="http://en.cppreference.com/w/cpp/utility/program/exit">std::exit</ulink>(<ulink url="http://en.cppreference.com/w/c/program/EXIT_status">EXIT_FAILURE</ulink>);
701     return <classname alt="boost::process::child">child</classname>(); //for C++ compliance
702 }
703
704 <classname alt="boost::process::child">child</classname> c(pid, exit_code);
705
706 <emphasis>unspecified();</emphasis>//here, we read the the error from the child process
707
708 if (<methodname alt="boost::process::extend::posix_executor::error">error</methodname>())
709     for (auto &amp; s : seq)
710         s.<methodname alt="boost::process::extend::handler::on_error">on_error</methodname>(*this, <methodname alt="boost::process::extend::posix_executor::error">error</methodname>());
711 else
712     for (auto &amp; s : seq)
713         s.<methodname alt="boost::process::extend::handler::on_error">on_success</methodname>(*this);
714
715 //now we check again, because a on_success handler might've errored.
716 if (<methodname alt="boost::process::extend::posix_executor::error">error</methodname>())
717 {
718     for (auto &amp; s : seq)
719         s.<methodname alt="boost::process::extend::handler::on_error">on_error</methodname>(*this, <methodname alt="boost::process::extend::posix_executor::error">error</methodname>());
720     return <classname alt="boost::process::child">child</classname>();
721 }
722 else
723     return c;
724 </programlisting>
725
726 <mediaobject>
727 <caption>
728 <para>The sequence if when no error occurs.</para>
729 </caption>
730 <imageobject>
731 <imagedata fileref="boost_process/posix_success.svg"/>
732 </imageobject>
733 </mediaobject>
734
735 <mediaobject>
736 <caption>
737 <para>The sequence if the execution fails.</para>
738 </caption>
739 <imageobject>
740 <imagedata fileref="boost_process/posix_exec_err.svg"/>
741 </imageobject>
742 </mediaobject>
743
744 <mediaobject>
745 <caption>
746 <para>The sequence if the fork fails.</para>
747 </caption>
748 <imageobject>
749 <imagedata fileref="boost_process/posix_fork_err.svg"/>
750 </imageobject>
751 </mediaobject>
752
753 </para><para><note><para>Error handling if execve fails is done through a pipe, unless ignore_error is used. </para></note>
754 </para></description><data-member name="seq"><type>Sequence &amp;</type><purpose>A reference to the actual initializer-sequence. </purpose></data-member>
755 <data-member name="exe"><type>const char *</type><purpose>A pointer to the name of the executable. </purpose></data-member>
756 <data-member name="cmd_line"><type>char *const *</type><purpose>A pointer to the argument-vector. </purpose></data-member>
757 <data-member name="env"><type>char **</type><purpose>A pointer to the environment variables, as default it is set to <ulink url="http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html">environ</ulink> </purpose></data-member>
758 <data-member name="pid"><type>pid_t</type><purpose>The pid of the process - it will be -1 before invoking <ulink url="http://pubs.opengroup.org/onlinepubs/009695399/functions/fork.html">fork</ulink>, and after forking either 0 for the new process or a positive value if in the current process. */. </purpose></data-member>
759 <data-member name="exit_status"><type>std::shared_ptr&lt; std::atomic&lt; int &gt; &gt;</type><purpose>This shared-pointer holds the exit code. It's done this way, so it can be shared between an <computeroutput>asio::io_service</computeroutput> and <classname alt="boost::process::child">child</classname>. </purpose></data-member>
760 <method-group name="public member functions">
761 <method name="error" cv="const"><type>const std::error_code &amp;</type><purpose>This function returns a const reference to the error state of the executor. </purpose></method>
762 <method name="set_error"><type>void</type><parameter name="ec"><paramtype>const std::error_code &amp;</paramtype></parameter><parameter name="msg"><paramtype>const std::string &amp;</paramtype></parameter><description><para>This function can be used to report an error to the executor. This will be handled according to the configuration of the executor, i.e. it might throw an exception. <note><para>This is the required way to handle errors in initializers. </para></note>
763 </para></description></method>
764 <method name="set_error"><type>void</type><parameter name="ec"><paramtype>const std::error_code &amp;</paramtype></parameter><parameter name="msg"><paramtype>const char *</paramtype></parameter><description><para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para></description></method>
765 </method-group>
766 </struct><struct name="windows_executor"><template>
767       <template-type-parameter name="Char"><purpose><para>The used char-type, either <computeroutput>char</computeroutput> or <computeroutput>wchar_t</computeroutput>.</para></purpose></template-type-parameter>
768       <template-type-parameter name="Sequence"><purpose><para>The used initializer-sequence, it is fulfills the boost.fusion <ulink url="http://www.boost.org/doc/libs/master/libs/fusion/doc/html/fusion/sequence.html">sequence</ulink> concept. </para></purpose></template-type-parameter>
769     </template><purpose>The windows executor type. </purpose><description><para>This type represents the posix executor and can be used for overloading in a custom handler.</para><para><note><para>It is an alias for the implementation on posix, and a forward-declaration on windows. </para></note>
770
771  
772 As information for extension development, here is the structure of the process launching (in pseudo-code and uml)<programlisting language="c++">
773 for (auto &amp; s : seq)
774     s.<methodname alt="boost::process::extend::handler::on_setup">on_setup</methodname>(*this);
775
776 if (<methodname alt="boost::process::extend::windows_executor::error">error</methodname>())
777 {
778     for (auto &amp; s : seq)
779        s.<methodname alt="boost::process::extend::handler::on_error">on_error</methodname>(*this, <methodname alt="boost::process::extend::windows_executor::error">error</methodname>());
780     return <classname alt="boost::process::child">child</classname>();
781 }
782 int err_code = <ulink url="https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425.aspx">CreateProcess</ulink>(
783          exe,
784          cmd_line,
785          proc_attrs,
786          thread_attrs,
787          creation_flags,
788          env,
789          work_dir,
790          startup_info,
791          proc_info);
792
793 <classname alt="boost::process::child">child</classname> c(proc_info, exit_code);
794
795 if (<methodname alt="boost::process::extend::windows_executor::error">error</methodname>())
796     for (auto &amp; s : seq)
797         s.<methodname alt="boost::process::extend::handler::on_error">on_error</methodname>(*this, <methodname alt="boost::process::extend::windows_executor::error">error</methodname>());
798 else
799     for (auto &amp; s : seq)
800         s.<methodname alt="boost::process::extend::handler::on_error">on_success</methodname>(*this);
801
802 //now we check again, because a on_success handler might've errored.
803 if (<methodname alt="boost::process::extend::windows_executor::error">error</methodname>())
804 {
805     for (auto &amp; s : seq)
806         s.<methodname alt="boost::process::extend::handler::on_error">on_error</methodname>(*this, <methodname alt="boost::process::extend::windows_executor::error">error</methodname>());
807     return <classname alt="boost::process::child">child</classname>();
808 }
809 else
810     return c;
811
812 </programlisting>
813 <mediaobject>
814 <caption>
815 <para>The sequence for windows process creation.</para>
816 </caption>
817 <imageobject>
818 <imagedata fileref="boost_process/windows_exec.svg"/>
819 </imageobject>
820 </mediaobject>
821  </para></description><typedef name="startup_info_t"><purpose>The type of the <ulink url="https://msdn.microsoft.com/en-us/library/windows/desktop/ms686331.aspx">startup-info</ulink>, depending on the char-type. </purpose><type><emphasis>unspecified</emphasis></type></typedef>
822 <typedef name="startup_info_ex_t"><purpose>The type of the <ulink url="https://msdn.microsoft.com/de-de/library/windows/desktop/ms686329.aspx">extended startup-info</ulink>, depending the char-type; only defined with winapi-version equal or higher than 6. </purpose><type><emphasis>unspecified</emphasis></type></typedef>
823 <data-member name="seq"><type>Sequence &amp;</type><purpose>A reference to the actual initializer-sequence. </purpose></data-member>
824 <data-member name="exe"><type>const Char *</type><purpose>A pointer to the name of the executable. It's null by default. </purpose></data-member>
825 <data-member name="cmd_line"><type>char Char *</type><purpose>A pointer to the argument-vector. Must be set by some initializer. </purpose></data-member>
826 <data-member name="env"><type>char Char *</type><purpose>A pointer to the environment variables. It's null by default. </purpose></data-member>
827 <data-member name="work_dir"><type>const Char *</type><purpose>A pointer to the working directory. It's null by default. </purpose></data-member>
828 <data-member name="proc_attrs"><type><emphasis>unspecified</emphasis></type><purpose>A pointer to the process-attributes of type <ulink url="https://msdn.microsoft.com/en-us/library/windows/desktop/aa379560.aspx">SECURITY_ATTRIBUTES</ulink>. It's null by default. </purpose></data-member>
829 <data-member name="thread_attrs"><type><emphasis>unspecified</emphasis></type><purpose>A pointer to the thread-attributes of type <ulink url="https://msdn.microsoft.com/en-us/library/windows/desktop/aa379560.aspx">SECURITY_ATTRIBUTES</ulink>. It' null by default. </purpose></data-member>
830 <data-member name="inherit_handles"><type><emphasis>unspecified</emphasis></type><purpose>A logical bool value setting whether handles shall be inherited or not. </purpose></data-member>
831 <data-member name="proc_info"><type><emphasis>unspecified</emphasis></type><purpose>The element holding the process-information after process creation. The type is <ulink url="https://msdn.microsoft.com/en-us/library/windows/desktop/ms684873.aspx">PROCESS_INFORMATION</ulink> </purpose></data-member>
832 <data-member name="exit_status"><type>std::shared_ptr&lt; std::atomic&lt; int &gt; &gt;</type><purpose>This shared-pointer holds the exit code. It's done this way, so it can be shared between an <computeroutput>asio::io_service</computeroutput> and <classname alt="boost::process::child">child</classname>. </purpose></data-member>
833 <data-member name="creation_flags"><type><emphasis>unspecified</emphasis></type><purpose>The creation flags of the process. </purpose></data-member>
834 <data-member name="startup_info"><type>startup_info_t</type><purpose>This element is an instance or a reference (if startup_info_ex exists) to the <ulink url="https://msdn.microsoft.com/en-us/library/windows/desktop/ms686331.aspx">startup-info</ulink> for the process. </purpose></data-member>
835 <data-member name="startup_info_ex"><type>startup_info_ex_t</type><purpose>This element is the instance of the <ulink url="https://msdn.microsoft.com/de-de/library/windows/desktop/ms686329.aspx">extended startup-info</ulink>. It is only available with a winapi-version equal or highter than 6. </purpose></data-member>
836 <method-group name="public member functions">
837 <method name="error" cv="const"><type>const std::error_code &amp;</type><purpose>This function returns a const reference to the error state of the executor. </purpose></method>
838 <method name="set_error"><type>void</type><parameter name="ec"><paramtype>const std::error_code &amp;</paramtype></parameter><parameter name="msg"><paramtype>const std::string &amp;</paramtype></parameter><description><para>This function can be used to report an error to the executor. This will be handled according to the configuration of the executor, i.e. it might throw an exception. <note><para>This is the required way to handle errors in initializers. </para></note>
839 </para></description></method>
840 <method name="set_error"><type>void</type><parameter name="ec"><paramtype>const std::error_code &amp;</paramtype></parameter><parameter name="msg"><paramtype>const char *</paramtype></parameter><description><para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para></description></method>
841 <method name="set_startup_info_ex"><type>void</type><purpose>This function switches the information, so that the extended structure is used. </purpose><description><para><note><para>It's only defined with winapi-version equal or higher than 6. </para></note>
842 </para></description></method>
843 </method-group>
844 </struct><data-member name="on_setup"><type><emphasis>unspecified</emphasis></type><purpose>This handler is invoked before the process in launched, to setup parameters. The required signature is <computeroutput>void(Exec &amp;)</computeroutput>, where <computeroutput>Exec</computeroutput> is a template parameter. </purpose></data-member>
845 <data-member name="on_error"><type><emphasis>unspecified</emphasis></type><purpose>This handler is invoked if an error occured. The required signature is <computeroutput>void(auto &amp; exec, const std::error_code&amp;)</computeroutput>, where <computeroutput>Exec</computeroutput> is a template parameter. </purpose></data-member>
846 <data-member name="on_success"><type><emphasis>unspecified</emphasis></type><purpose>This handler is invoked if launching the process has succeeded. The required signature is <computeroutput>void(auto &amp; exec)</computeroutput>, where <computeroutput>Exec</computeroutput> is a template parameter. </purpose></data-member>
847 <data-member name="on_fork_error"><type><emphasis>unspecified</emphasis></type><purpose>This handler is invoked if the fork failed. The required signature is <computeroutput>void(auto &amp; exec)</computeroutput>, where <computeroutput>Exec</computeroutput> is a template parameter. </purpose><description><para><note><para>Only available on posix. </para></note>
848 </para></description></data-member>
849 <data-member name="on_exec_setup"><type><emphasis>unspecified</emphasis></type><purpose>This handler is invoked if the fork succeeded. The required signature is <computeroutput>void(Exec &amp;)</computeroutput>, where <computeroutput>Exec</computeroutput> is a template parameter. </purpose><description><para><note><para>Only available on posix. </para></note>
850 </para></description></data-member>
851 <data-member name="on_exec_error"><type><emphasis>unspecified</emphasis></type><purpose>This handler is invoked if the exec call errored. The required signature is <computeroutput>void(auto &amp; exec)</computeroutput>, where <computeroutput>Exec</computeroutput> is a template parameter. </purpose><description><para><note><para>Only available on posix. </para></note>
852 </para></description></data-member>
853 <function name="get_last_error"><type>std::error_code</type><purpose>Helper function to get the last error code system-independent. </purpose></function>
854 <overloaded-function name="throw_last_error"><signature><type>void</type><parameter name="msg"><paramtype>const std::string &amp;</paramtype><description><para>A message to add to the error code. </para></description></parameter></signature><signature><type>void</type></signature><description><para>Helper function to get and throw the last system error. 
855
856 </para></description><throws><simpara><classname>boost::process::process_error</classname> </simpara></throws></overloaded-function>
857
858 <function name="get_io_service"><type>asio::io_service &amp;</type><template>
859           <template-type-parameter name="Sequence"/>
860         </template><parameter name="seq"><paramtype>const Sequence &amp;</paramtype><description><para>The Sequence of the initializer. </para></description></parameter><description><para>This function gets the io_service from the initializer sequence.</para><para><note><para>Yields a compile-time error if no <computeroutput>io_service</computeroutput> is provided. </para></note>
861
862 </para></description></function>
863 </namespace>
864
865
866
867
868
869
870
871 </namespace>
872 </namespace>
873 </header>
874 <header name="boost/process/group.hpp">
875 <para>Defines a group process class. For additional information see the platform specific implementations:</para><para><itemizedlist>
876 <listitem><para><ulink url="https://msdn.microsoft.com/en-us/library/windows/desktop/ms684161.aspx">windows - job object</ulink></para></listitem><listitem><para><ulink url="http://pubs.opengroup.org/onlinepubs/009695399/functions/setpgid.html">posix - process group</ulink> </para></listitem></itemizedlist>
877 </para><namespace name="boost">
878 <namespace name="process">
879 <class name="group"><description><para>Represents a process group.</para><para>Groups are movable but non-copyable. The destructor automatically closes handles to the group process.</para><para>The group will have the same interface as std::thread.</para><para><note><para>If the destructor is called without a previous detach or wait, the group will be terminated.</para></note>
880 <note><para>If a default-constructed group is used before being used in a process launch, the behaviour is undefined.</para><para>Waiting for groups is currently broken on windows and will most likely result in a dead-lock. </para></note>
881 </para></description><typedef name="group_handle"><type><emphasis>unspecified</emphasis></type></typedef>
882 <typedef name="native_handle_t"><purpose>Native representation of the handle. </purpose><type>group_handle::handle_t</type></typedef>
883 <method-group name="public member functions">
884 <method name="detach"><type>void</type><purpose>Detach the group. </purpose></method>
885 <method name="join"><type>void</type><description><para>Join the child. This just calls wait, but that way the naming is similar to std::thread </para></description></method>
886 <method name="joinable"><type>bool</type><description><para>Check if the child is joinable. </para></description></method>
887 <method name="native_handle" cv="const"><type>native_handle_t</type><purpose>Obtain the native handle of the group. </purpose></method>
888 <method name="wait"><type>void</type><purpose>Wait for the process group to exit. </purpose></method>
889 <method name="wait" cv="noexcept"><type>void</type><parameter name="ec"><paramtype>std::error_code &amp;</paramtype></parameter><description><para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para></description></method>
890 <method name="wait_for"><type>bool</type><template>
891           <template-type-parameter name="Rep"/>
892           <template-type-parameter name="Period"/>
893         </template><parameter name="rel_time"><paramtype>const std::chrono::duration&lt; Rep, Period &gt; &amp;</paramtype></parameter><description><para>Wait for the process group to exit for period of time. 
894 </para></description><returns><para>True if all child processes exited while waiting. </para></returns></method>
895 <method name="wait_for" cv="noexcept"><type>bool</type><template>
896           <template-type-parameter name="Rep"/>
897           <template-type-parameter name="Period"/>
898         </template><parameter name="rel_time"><paramtype>const std::chrono::duration&lt; Rep, Period &gt; &amp;</paramtype></parameter><parameter name="ec"><paramtype>std::error_code &amp;</paramtype></parameter><description><para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para></description></method>
899 <method name="wait_until"><type>bool</type><template>
900           <template-type-parameter name="Clock"/>
901           <template-type-parameter name="Duration"/>
902         </template><parameter name="timeout_time"><paramtype>const std::chrono::time_point&lt; Clock, Duration &gt; &amp;</paramtype></parameter><description><para>Wait for the process group to exit until a point in time. 
903 </para></description><returns><para>True if all child processes exited while waiting. </para></returns></method>
904 <method name="wait_until" cv="noexcept"><type>bool</type><template>
905           <template-type-parameter name="Clock"/>
906           <template-type-parameter name="Duration"/>
907         </template><parameter name="timeout_time"><paramtype>const std::chrono::time_point&lt; Clock, Duration &gt; &amp;</paramtype></parameter><parameter name="ec"><paramtype>std::error_code &amp;</paramtype></parameter><description><para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para></description></method>
908 <method name="valid" cv="const"><type>bool</type><purpose>Check if the group has a valid handle. </purpose></method>
909 <method name="conversion-operator" cv="const" specifiers="explicit"><type>bool</type><purpose>Convenience to call valid. </purpose></method>
910 <method name="terminate"><type>void</type><purpose>Terminate the process group, i.e. all processes in the group. </purpose></method>
911 <method name="terminate" cv="noexcept"><type>void</type><parameter name="ec"><paramtype>std::error_code &amp;</paramtype></parameter><description><para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para></description></method>
912 <method name="add"><type>void</type><parameter name="c"><paramtype>const <classname>child</classname> &amp;</paramtype></parameter><purpose>Assign a child process to the group. </purpose></method>
913 <method name="add" cv="noexcept"><type>void</type><parameter name="c"><paramtype>const <classname>child</classname> &amp;</paramtype></parameter><parameter name="ec"><paramtype>std::error_code &amp;</paramtype></parameter><description><para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para></description></method>
914 <method name="has"><type>bool</type><parameter name="c"><paramtype>const <classname>child</classname> &amp;</paramtype></parameter><purpose>Check if the child process is in the group. </purpose></method>
915 <method name="has" cv="noexcept"><type>bool</type><parameter name="c"><paramtype>const <classname>child</classname> &amp;</paramtype></parameter><parameter name="ec"><paramtype>std::error_code &amp;</paramtype></parameter><description><para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para></description></method>
916 </method-group>
917 <constructor specifiers="explicit"><parameter name="ch"><paramtype>group_handle &amp;&amp;</paramtype></parameter></constructor>
918 <constructor specifiers="explicit"><parameter name="handle"><paramtype>native_handle_t &amp;</paramtype></parameter><purpose>Construct the group from a native_handle. </purpose></constructor>
919 <constructor cv="= delete"><parameter name=""><paramtype>const <classname>group</classname> &amp;</paramtype></parameter></constructor>
920 <constructor><parameter name="lhs"><paramtype><classname>group</classname> &amp;&amp;</paramtype></parameter><purpose>Move constructor. </purpose></constructor>
921 <constructor cv="= default"><purpose>Default constructor. </purpose></constructor>
922 <copy-assignment cv="= delete"><type><classname>group</classname> &amp;</type><parameter name=""><paramtype>const <classname>group</classname> &amp;</paramtype></parameter></copy-assignment>
923 <copy-assignment><type><classname>group</classname> &amp;</type><parameter name="lhs"><paramtype><classname>group</classname> &amp;&amp;</paramtype></parameter><purpose>Move assign. </purpose></copy-assignment>
924 <destructor><description><para>Destructor</para><para><note><para>If the destructor is called without a previous detach or wait, the group will be terminated. </para></note>
925 </para></description></destructor>
926 </class>
927
928
929
930
931
932
933 </namespace>
934 </namespace>
935 </header>
936 <header name="boost/process/io.hpp">
937 <para>Header which provides the io properties. It provides the following properties:</para><para> 
938 <programlisting language="c++">
939 namespace boost {
940   namespace process {
941     <emphasis>unspecified</emphasis> <globalname alt="boost::process::close">close</globalname>;
942     <emphasis>unspecified</emphasis> <globalname alt="boost::process::null">null</globalname>;
943     <emphasis>unspecified</emphasis> <globalname alt="boost::process::std_in">std_in</globalname>;
944     <emphasis>unspecified</emphasis> <globalname alt="boost::process::std_out">std_out</globalname>;
945     <emphasis>unspecified</emphasis> <globalname alt="boost::process::std_err">std_err</globalname>;
946   }
947 }
948 </programlisting>
949 </para><para><formalpara><title>File I/O</title><para/></formalpara>
950 The library allows full redirection of streams to files as shown below.</para><para><programlisting language="c++">boost::filesystem::path log    = "my_log_file.txt";
951 boost::filesystem::path input  = "input.txt";
952 boost::filesystem::path output = "output.txt";
953 system("my_prog", std_out&gt;output, std_in&lt;input, std_err&gt;log);
954 </programlisting></para><para><formalpara><title>Synchronous Pipe I/O</title><para/></formalpara>
955 Another way is to communicate through pipes.</para><para><programlisting language="c++">pstream str;
956 child c("my_prog", std_out &gt; str);
957
958 int i;
959 str &gt;&gt; i;
960 </programlisting></para><para>Note that the pipe may also be used between several processes, like this:</para><para><programlisting language="c++">pipe p;
961 child c1("nm", "a.out", std_out&gt;p);
962 child c2("c++filt", std_in&lt;p);
963 </programlisting></para><para><formalpara><title>Asynchronous I/O</title><para/></formalpara>
964 Utilizing <computeroutput>boost.asio</computeroutput> asynchronous I/O is provided.</para><para><programlisting language="c++">boost::asio::io_service ios;
965 std::future&lt;std::string&gt; output;
966 system("ls", std_out &gt; output, ios);
967
968 auto res = fut.get();
969 </programlisting></para><para><note><para><computeroutput>boost/process/asnyc.hpp</computeroutput> must also be included for this to work.</para></note>
970 <formalpara><title>Closing</title><para/></formalpara>
971 Stream can be closed, so nothing can be read or written.</para><para><programlisting language="c++">system("foo", std_in.close());
972 </programlisting></para><para><formalpara><title>Null</title><para/></formalpara>
973 Streams can be redirected to null, which means, that written date will be discarded and read data will only contain <computeroutput>EOF</computeroutput>.</para><para><programlisting language="c++">system("b2", std_out &gt; null);
974 </programlisting> </para><namespace name="boost">
975 <namespace name="process">
976 <data-member name="close"><type><emphasis>unspecified</emphasis></type><purpose>This constant is a utility to allow syntax like <computeroutput>std_out &gt; close</computeroutput> for closing I/O streams. </purpose></data-member>
977 <data-member name="null"><type><emphasis>unspecified</emphasis></type><purpose>This constant is a utility to redirect streams to the null-device. </purpose></data-member>
978 <data-member name="std_in"><type><emphasis>unspecified</emphasis></type><description><para>This property allows to set the input stream for the child process.</para><sect1 id="namespaceboost_1_1process_1stdin_details">
979 <title>Details</title>
980 <sect2 id="namespaceboost_1_1process_1stdin_file">
981 <title>File Input</title>
982 <para>The file I/O simple redirects the stream to a file, for which the possible types are</para><para><itemizedlist>
983 <listitem><para><computeroutput>boost::filesystem::path</computeroutput></para></listitem><listitem><para><computeroutput>std::basic_string&lt;char_type&gt;</computeroutput></para></listitem><listitem><para><computeroutput>const char_type*</computeroutput></para></listitem><listitem><para><computeroutput>FILE*</computeroutput></para></listitem></itemizedlist>
984 </para><para>with <computeroutput>char_type</computeroutput> being either <computeroutput>char</computeroutput> or <computeroutput>wchar_t</computeroutput>.</para><para>FILE* is explicitly added, so the process can easily redirect the output stream of the child to another output stream of the process. That is:</para><para><programlisting language="c++">system("ls", std_in &lt; stdin);
985 </programlisting></para><para><warning><para>If the launching and the child process use the input, this leads to undefined behaviour.</para></warning>
986 A syntax like <computeroutput>system("ls", std_out &gt; std::cerr)</computeroutput> is not possible, due to the C++ implementation not providing access to the handle.</para><para>The valid expressions for this property are</para><para><programlisting language="c++">std_in &lt; file;
987 std_in = file;
988 </programlisting></para></sect2>
989 <sect2 id="namespaceboost_1_1process_1stdin_pipe">
990 <title>Pipe Input</title>
991 <para>As explained in the corresponding section, the boost.process library provides a <classname alt="boost::process::async_pipe">async_pipe</classname> class which can be used to communicate with child processes.</para><para><note><para>Technically the <classname alt="boost::process::async_pipe">async_pipe</classname> works synchronous here, since no asio implementation is used by the library here. The async-operation will then however not end if the process is finished, since the pipe remains open. You can use the async_close function with on_exit to fix that.</para></note>
992 Valid expressions with pipes are these:</para><para><programlisting language="c++">std_in &lt; pipe;
993 std_in = pipe;
994 </programlisting></para><para>Where the valid types for <computeroutput>pipe</computeroutput> are the following:</para><para><itemizedlist>
995 <listitem><para><computeroutput><classname alt="boost::process::basic_pipe">basic_pipe</classname></computeroutput></para></listitem><listitem><para><computeroutput><classname alt="boost::process::async_pipe">async_pipe</classname></computeroutput></para></listitem><listitem><para><computeroutput><classname alt="boost::process::basic_opstream">basic_opstream</classname></computeroutput></para></listitem><listitem><para><computeroutput><classname alt="boost::process::basic_pstream">basic_pstream</classname></computeroutput></para></listitem></itemizedlist>
996 </para><para>Note that the pipe may also be used between several processes, like this:</para><para><programlisting language="c++">pipe p;
997 child c1("nm", "a.out", std_out&gt;p);
998 child c2("c++filt", std_in&lt;p);
999 </programlisting></para></sect2>
1000 <sect2 id="namespaceboost_1_1process_1stdin_async_pipe">
1001 <title>Asynchronous Pipe Input</title>
1002 <para>Asynchronous Pipe I/O classifies communication which has automatically handling of the asynchronous operations by the process library. This means, that a pipe will be constructed, the async_read/-write will be automatically started, and that the end of the child process will also close the pipe.</para><para>Valid types for pipe I/O are the following:</para><para><itemizedlist>
1003 <listitem><para><computeroutput>boost::asio::const_buffer</computeroutput> <footnote><para> Constructed with <code>boost::asio::buffer</code></para></footnote> </para></listitem><listitem><para><computeroutput>boost::asio::mutable_buffer</computeroutput> <footnote><para> Constructed with <code>boost::asio::buffer</code></para></footnote> </para></listitem><listitem><para><computeroutput>boost::asio::streambuf</computeroutput></para></listitem></itemizedlist>
1004 </para><para>Valid expressions with pipes are these:</para><para><programlisting language="c++">std_in &lt; buffer;
1005 std_in = buffer;
1006 std_out &gt; buffer;
1007 std_out = buffer;
1008 std_err &gt; buffer;
1009 std_err = buffer;
1010 (std_out &amp; std_err) &gt; buffer;
1011 (std_out &amp; std_err) = buffer;
1012 </programlisting></para><para><note><para>It is also possible to get a future for std_in, by chaining another <computeroutput>std::future&lt;void&gt;</computeroutput> onto it, so you can wait for the input to be completed. It looks like this: <programlisting language="c++">std::future&lt;void&gt; fut;
1013 boost::asio::io_service ios;
1014 std::string data;
1015 child c("prog", std_in &lt; buffer(data) &gt;  fut, ios);
1016 fut.get();
1017 </programlisting></para><para><computeroutput>boost::asio::buffer</computeroutput> is also available in the <computeroutput>boost::process</computeroutput> namespace.</para></note>
1018 <warning><para>This feature requires <computeroutput>boost/process/async.hpp</computeroutput> to be included and a reference to <computeroutput>boost::asio::io_service</computeroutput> to be passed to the launching function.</para></warning>
1019 </para></sect2>
1020 <sect2 id="namespaceboost_1_1process_1stdin_close">
1021 <title>Close</title>
1022 <para>The input stream can be closed, so it cannot be read from. This will lead to an error when attempted.</para><para>This can be achieved by the following syntax.</para><para><programlisting language="c++">std_in &lt; close;
1023 std_in = close;
1024 std_in.close();
1025 </programlisting></para></sect2>
1026 <sect2 id="namespaceboost_1_1process_1stdin_null">
1027 <title>Null</title>
1028 <para>The input stream can be redirected to read from the null-device, which means that only <computeroutput>EOF</computeroutput> is read.</para><para>The syntax to achieve that has the following variants:</para><para><programlisting language="c++">std_in &lt; null;
1029 std_in = null;
1030 std_in.null();
1031 </programlisting> </para></sect2>
1032 </sect1></description></data-member>
1033 <data-member name="std_out"><type><emphasis>unspecified</emphasis></type><description><para>This property allows to set the output stream for the child process.</para><para><note><para>The Semantic is the same as for <globalname alt="boost::process::std_err">std_err</globalname> </para><para><computeroutput>std_err</computeroutput> and <computeroutput>std_out</computeroutput> can be combined into one stream, with the <computeroutput>operator &amp;</computeroutput>, i.e. <computeroutput>std_out &amp; std_err</computeroutput>.</para></note>
1034 </para><sect1 id="namespaceboost_1_1process_1stdout_details">
1035 <title>Details</title>
1036 <sect2 id="namespaceboost_1_1process_1stdout_file">
1037 <title>File Input</title>
1038 <para>The file I/O simple redirects the stream to a file, for which the possible types are</para><para><itemizedlist>
1039 <listitem><para><computeroutput>boost::filesystem::path</computeroutput></para></listitem><listitem><para><computeroutput>std::basic_string&lt;char_type&gt;</computeroutput></para></listitem><listitem><para><computeroutput>const char_type*</computeroutput></para></listitem><listitem><para><computeroutput>FILE*</computeroutput></para></listitem></itemizedlist>
1040 </para><para>with <computeroutput>char_type</computeroutput> being either <computeroutput>char</computeroutput> or <computeroutput>wchar_t</computeroutput>.</para><para>FILE* is explicitly added, so the process can easily redirect the output stream of the child to another output stream of the process. That is:</para><para><programlisting language="c++">system("ls", std_out &lt; stdin);
1041 </programlisting></para><para><warning><para>If the launching and the child process use the input, this leads to undefined behaviour.</para></warning>
1042 A syntax like <computeroutput>system("ls", std_out &gt; std::cerr)</computeroutput> is not possible, due to the C++ implementation not providing access to the handle.</para><para>The valid expressions for this property are</para><para><programlisting language="c++">std_out &lt; file;
1043 std_out = file;
1044 </programlisting></para></sect2>
1045 <sect2 id="namespaceboost_1_1process_1stdout_pipe">
1046 <title>Pipe Output</title>
1047 <para>As explained in the corresponding section, the boost.process library provides a <classname alt="boost::process::async_pipe">async_pipe</classname> class which can be used to communicate with child processes.</para><para><note><para>Technically the <classname alt="boost::process::async_pipe">async_pipe</classname> works like a synchronous pipe here, since no asio implementation is used by the library here. The asynchronous operation will then however not end if the process is finished, since the pipe remains open. You can use the async_close function with on_exit to fix that.</para></note>
1048 Valid expressions with pipes are these:</para><para><programlisting language="c++">std_out &gt; pipe;
1049 std_out = pipe;
1050 </programlisting></para><para>Where the valid types for <computeroutput>pipe</computeroutput> are the following:</para><para><itemizedlist>
1051 <listitem><para><computeroutput><classname alt="boost::process::basic_pipe">basic_pipe</classname></computeroutput></para></listitem><listitem><para><computeroutput><classname alt="boost::process::async_pipe">async_pipe</classname></computeroutput></para></listitem><listitem><para><computeroutput><classname alt="boost::process::basic_ipstream">basic_ipstream</classname></computeroutput></para></listitem><listitem><para><computeroutput><classname alt="boost::process::basic_pstream">basic_pstream</classname></computeroutput></para></listitem></itemizedlist>
1052 </para><para>Note that the pipe may also be used between several processes, like this:</para><para><programlisting language="c++">pipe p;
1053 child c1("nm", "a.out", std_out&gt;p);
1054 child c2("c++filt", std_in&lt;p);
1055 </programlisting></para></sect2>
1056 <sect2 id="namespaceboost_1_1process_1stdout_async_pipe">
1057 <title>Asynchronous Pipe Output</title>
1058 <para>Asynchronous Pipe I/O classifies communication which has automatically handling of the async operations by the process library. This means, that a pipe will be constructed, the async_read/-write will be automatically started, and that the end of the child process will also close the pipe.</para><para>Valid types for pipe I/O are the following:</para><para><itemizedlist>
1059 <listitem><para><computeroutput>boost::asio::mutable_buffer</computeroutput> <footnote><para> Constructed with <code>boost::asio::buffer</code></para></footnote> </para></listitem><listitem><para><computeroutput>boost::asio::streambuf</computeroutput></para></listitem><listitem><para><computeroutput>std::future&lt;std::vector&lt;char&gt;&gt;</computeroutput></para></listitem><listitem><para><computeroutput>std::future&lt;std::string&gt;</computeroutput></para></listitem></itemizedlist>
1060 </para><para>Valid expressions with pipes are these:</para><para><programlisting language="c++">std_out &gt; buffer;
1061 std_out = buffer;
1062 std_err &gt; buffer;
1063 std_err = buffer;
1064 (std_out &amp; std_err) &gt; buffer;
1065 (std_out &amp; std_err) = buffer;
1066 </programlisting></para><para><note><para><computeroutput>boost::asio::buffer</computeroutput> is also available in the <computeroutput>boost::process</computeroutput> namespace.</para></note>
1067 <warning><para>This feature requires <computeroutput>boost/process/async.hpp</computeroutput> to be included and a reference to <computeroutput>boost::asio::io_service</computeroutput> to be passed to the launching function.</para></warning>
1068 </para></sect2>
1069 <sect2 id="namespaceboost_1_1process_1stdout_close">
1070 <title>Close</title>
1071 <para>The out stream can be closed, so it cannot be write from. This will lead to an error when attempted.</para><para>This can be achieved by the following syntax.</para><para><programlisting language="c++">std_out &gt; close;
1072 std_out = close;
1073 std_out.close();
1074 </programlisting></para></sect2>
1075 <sect2 id="namespaceboost_1_1process_1stdout_null">
1076 <title>Null</title>
1077 <para>The output stream can be redirected to write to the null-device, which means that all output is discarded.</para><para>The syntax to achieve that has the following variants:</para><para><programlisting language="c++">std_out &gt; null;
1078 std_out = null;
1079 std_out.null();
1080 </programlisting> </para></sect2>
1081 </sect1></description></data-member>
1082 <data-member name="std_err"><type><emphasis>unspecified</emphasis></type><description><para>This property allows setting the <computeroutput>stderr</computeroutput> stream. The semantic and syntax is the same as for  <globalname alt="boost::process::std_out">std_out</globalname>  . </para></description></data-member>
1083
1084
1085
1086
1087
1088
1089
1090 </namespace>
1091 </namespace>
1092 </header>
1093 <header name="boost/process/locale.hpp">
1094 <namespace name="boost">
1095 <namespace name="process">
1096 <typedef name="codecvt_type"><purpose>The internally used type for code conversion. </purpose><type>std::codecvt&lt; wchar_t, char, std::mbstate_t &gt;</type></typedef>
1097
1098 <function name="codecvt_category"><type>const std::error_category &amp;</type><purpose>Internally used error cateory for code conversion. </purpose></function>
1099 <function name="codecvt"><type>const codecvt_type &amp;</type><purpose>Get a reference to the currently used code converter. </purpose></function>
1100 <function name="imbue"><type>std::locale</type><parameter name="loc"><paramtype>const std::locale &amp;</paramtype></parameter><purpose>Set the locale of the library. </purpose></function>
1101
1102
1103
1104 </namespace>
1105 </namespace>
1106 </header>
1107 <header name="boost/process/pipe.hpp">
1108 <namespace name="boost">
1109 <namespace name="process">
1110 <class name="basic_pipe"><template>
1111       <template-type-parameter name="CharT"/>
1112       <template-type-parameter name="Traits"><default>std::char_traits&lt;CharT&gt;</default></template-type-parameter>
1113     </template><description><para>Class implementation of a pipe. </para></description><typedef name="char_type"><type>CharT</type></typedef>
1114 <typedef name="traits_type"><type>Traits</type></typedef>
1115 <typedef name="int_type"><type>Traits::int_type</type></typedef>
1116 <typedef name="pos_type"><type>Traits::pos_type</type></typedef>
1117 <typedef name="off_type"><type>Traits::off_type</type></typedef>
1118 <typedef name="native_handle"><type><emphasis>unspecified</emphasis></type></typedef>
1119 <method-group name="public member functions">
1120 <method name="native_source" cv="const"><type>native_handle</type><description><para>Get the native handle of the source. </para></description></method>
1121 <method name="native_sink" cv="const"><type>native_handle</type><description><para>Get the native handle of the sink. </para></description></method>
1122 <method name="assign_source"><type>void</type><parameter name="h"><paramtype>native_handle</paramtype></parameter><description><para>Assign a new value to the source </para></description></method>
1123 <method name="assign_sink"><type>void</type><parameter name="h"><paramtype>native_handle</paramtype></parameter><description><para>Assign a new value to the sink </para></description></method>
1124 <method name="write"><type>int_type</type><parameter name="data"><paramtype>const char_type *</paramtype></parameter><parameter name="count"><paramtype>int_type</paramtype></parameter><purpose>Write data to the pipe. </purpose></method>
1125 <method name="read"><type>int_type</type><parameter name="data"><paramtype>char_type *</paramtype></parameter><parameter name="count"><paramtype>int_type</paramtype></parameter><purpose>Read data from the pipe. </purpose></method>
1126 <method name="is_open"><type>bool</type><purpose>Check if the pipe is open. </purpose></method>
1127 <method name="close"><type>void</type><purpose>Close the pipe. </purpose></method>
1128 </method-group>
1129 <constructor><purpose>Default construct the pipe. Will be opened. </purpose></constructor>
1130 <constructor specifiers="explicit"><parameter name="name"><paramtype>const std::string &amp;</paramtype></parameter><purpose>Construct a named pipe. </purpose></constructor>
1131 <constructor><parameter name="p"><paramtype>const <classname>basic_pipe</classname> &amp;</paramtype></parameter><description><para>Copy construct the pipe. <note><para>Duplicated the handles. </para></note>
1132 </para></description></constructor>
1133 <constructor><parameter name="lhs"><paramtype><classname>basic_pipe</classname> &amp;&amp;</paramtype></parameter><description><para>Move construct the pipe. </para></description></constructor>
1134 <copy-assignment><type><classname>basic_pipe</classname> &amp;</type><parameter name="p"><paramtype>const <classname>basic_pipe</classname> &amp;</paramtype></parameter><description><para>Copy assign the pipe. <note><para>Duplicated the handles. </para></note>
1135 </para></description></copy-assignment>
1136 <copy-assignment><type><classname>basic_pipe</classname> &amp;</type><parameter name="lhs"><paramtype><classname>basic_pipe</classname> &amp;&amp;</paramtype></parameter><description><para>Move assign the pipe. </para></description></copy-assignment>
1137 <destructor><description><para>Destructor closes the handles. </para></description></destructor>
1138 </class><struct name="basic_pipebuf"><template>
1139       <template-type-parameter name="CharT"/>
1140       <template-type-parameter name="Traits"><default>std::char_traits&lt;CharT&gt;</default></template-type-parameter>
1141     </template><inherit access="public">std::basic_streambuf&lt; CharT, Traits &gt;</inherit><description><para>Implementation of the stream buffer for a pipe. </para></description><typedef name="pipe_type"><type><classname>basic_pipe</classname>&lt; CharT, Traits &gt;</type></typedef>
1142 <typedef name="char_type"><type>CharT</type></typedef>
1143 <typedef name="traits_type"><type>Traits</type></typedef>
1144 <typedef name="int_type"><type>Traits::int_type</type></typedef>
1145 <typedef name="pos_type"><type>Traits::pos_type</type></typedef>
1146 <typedef name="off_type"><type>Traits::off_type</type></typedef>
1147 <data-member name="default_buffer_size" specifiers="static"><type>constexpr int</type></data-member>
1148 <method-group name="public member functions">
1149 <method name="overflow"><type>int_type</type><parameter name="ch"><paramtype>int_type</paramtype><default>traits_type::eof()</default></parameter><purpose>Writes characters to the associated output sequence from the put area. </purpose></method>
1150 <method name="sync"><type>int</type><purpose>Synchronizes the buffers with the associated character sequence. </purpose></method>
1151 <method name="underflow"><type>int_type</type><purpose>Reads characters from the associated input sequence to the get area. </purpose></method>
1152 <method name="pipe"><type>void</type><parameter name="p"><paramtype><classname>pipe_type</classname> &amp;&amp;</paramtype></parameter><purpose>Set the pipe of the streambuf. </purpose></method>
1153 <method name="pipe"><type>void</type><parameter name="p"><paramtype>const <classname>pipe_type</classname> &amp;</paramtype></parameter><purpose>Set the pipe of the streambuf. </purpose></method>
1154 <method name="pipe"><type><classname>pipe_type</classname> &amp;</type><purpose>Get a reference to the pipe. </purpose></method>
1155 <method name="pipe" cv="const"><type>const <classname>pipe_type</classname> &amp;</type><purpose>Get a const reference to the pipe. </purpose></method>
1156 <method name="pipe"><type><classname>pipe_type</classname> &amp;&amp;</type><purpose>Get a rvalue reference to the pipe. Qualified as rvalue. </purpose></method>
1157 </method-group>
1158 <constructor><purpose>Default constructor, will also construct the pipe. </purpose></constructor>
1159 <constructor cv="= default"><parameter name=""><paramtype>const <classname>basic_pipebuf</classname> &amp;</paramtype></parameter><purpose>Copy Constructor. </purpose></constructor>
1160 <constructor cv="= default"><parameter name=""><paramtype><classname>basic_pipebuf</classname> &amp;&amp;</paramtype></parameter><purpose>Move Constructor. </purpose></constructor>
1161 <constructor><parameter name="p"><paramtype><classname>pipe_type</classname> &amp;&amp;</paramtype></parameter><purpose>Move construct from a pipe. </purpose></constructor>
1162 <constructor><parameter name="p"><paramtype>const <classname>pipe_type</classname> &amp;</paramtype></parameter><purpose>Construct from a pipe. </purpose></constructor>
1163 <copy-assignment cv="= delete"><type><classname>basic_pipebuf</classname> &amp;</type><parameter name=""><paramtype>const <classname>basic_pipebuf</classname> &amp;</paramtype></parameter><purpose>Copy assign. </purpose></copy-assignment>
1164 <copy-assignment cv="= default"><type><classname>basic_pipebuf</classname> &amp;</type><parameter name=""><paramtype><classname>basic_pipebuf</classname> &amp;&amp;</paramtype></parameter><purpose>Move assign. </purpose></copy-assignment>
1165 <copy-assignment><type><classname>basic_pipebuf</classname> &amp;</type><parameter name="p"><paramtype><classname>pipe_type</classname> &amp;&amp;</paramtype></parameter><purpose>Move assign a pipe. </purpose></copy-assignment>
1166 <copy-assignment><type><classname>basic_pipebuf</classname> &amp;</type><parameter name="p"><paramtype>const <classname>pipe_type</classname> &amp;</paramtype></parameter><purpose>Copy assign a pipe. </purpose></copy-assignment>
1167 <method-group name="private member functions">
1168 <method name="_write_impl"><type>bool</type></method>
1169 </method-group>
1170 </struct><class name="basic_ipstream"><template>
1171       <template-type-parameter name="CharT"/>
1172       <template-type-parameter name="Traits"><default>std::char_traits&lt;CharT&gt;</default></template-type-parameter>
1173     </template><inherit access="public">std::basic_istream&lt; CharT, Traits &gt;</inherit><description><para>Implementation of a reading pipe stream. </para></description><typedef name="pipe_type"><type><classname>basic_pipe</classname>&lt; CharT, Traits &gt;</type></typedef>
1174 <typedef name="char_type"><type>CharT</type></typedef>
1175 <typedef name="traits_type"><type>Traits</type></typedef>
1176 <typedef name="int_type"><type>Traits::int_type</type></typedef>
1177 <typedef name="pos_type"><type>Traits::pos_type</type></typedef>
1178 <typedef name="off_type"><type>Traits::off_type</type></typedef>
1179 <method-group name="public member functions">
1180 <method name="rdbuf" cv="const"><type><classname>basic_pipebuf</classname>&lt; CharT, Traits &gt; *</type><purpose>Get access to the underlying stream_buf. </purpose></method>
1181 <method name="pipe"><type>void</type><parameter name="p"><paramtype><classname>pipe_type</classname> &amp;&amp;</paramtype></parameter><purpose>Set the pipe of the streambuf. </purpose></method>
1182 <method name="pipe"><type>void</type><parameter name="p"><paramtype>const <classname>pipe_type</classname> &amp;</paramtype></parameter><purpose>Set the pipe of the streambuf. </purpose></method>
1183 <method name="pipe"><type><classname>pipe_type</classname> &amp;</type><purpose>Get a reference to the pipe. </purpose></method>
1184 <method name="pipe" cv="const"><type>const <classname>pipe_type</classname> &amp;</type><purpose>Get a const reference to the pipe. </purpose></method>
1185 <method name="pipe"><type><classname>pipe_type</classname> &amp;&amp;</type><purpose>Get a rvalue reference to the pipe. Qualified as rvalue. </purpose></method>
1186 </method-group>
1187 <constructor><purpose>Default constructor. </purpose></constructor>
1188 <constructor cv="= delete"><parameter name=""><paramtype>const <classname>basic_ipstream</classname> &amp;</paramtype></parameter><purpose>Copy constructor. </purpose></constructor>
1189 <constructor cv="= default"><parameter name=""><paramtype><classname>basic_ipstream</classname> &amp;&amp;</paramtype></parameter><purpose>Move constructor. </purpose></constructor>
1190 <constructor><parameter name="p"><paramtype><classname>pipe_type</classname> &amp;&amp;</paramtype></parameter><purpose>Move construct from a pipe. </purpose></constructor>
1191 <constructor><parameter name="p"><paramtype>const <classname>pipe_type</classname> &amp;</paramtype></parameter><purpose>Copy construct from a pipe. </purpose></constructor>
1192 <copy-assignment cv="= delete"><type><classname>basic_ipstream</classname> &amp;</type><parameter name=""><paramtype>const <classname>basic_ipstream</classname> &amp;</paramtype></parameter><purpose>Copy assignment. </purpose></copy-assignment>
1193 <copy-assignment cv="= default"><type><classname>basic_ipstream</classname> &amp;</type><parameter name=""><paramtype><classname>basic_ipstream</classname> &amp;&amp;</paramtype></parameter><purpose>Move assignment. </purpose></copy-assignment>
1194 <copy-assignment><type><classname>basic_ipstream</classname> &amp;</type><parameter name="p"><paramtype><classname>pipe_type</classname> &amp;&amp;</paramtype></parameter><purpose>Move assignment of a pipe. </purpose></copy-assignment>
1195 <copy-assignment><type><classname>basic_ipstream</classname> &amp;</type><parameter name="p"><paramtype>const <classname>pipe_type</classname> &amp;</paramtype></parameter><purpose>Copy assignment of a pipe. </purpose></copy-assignment>
1196 </class><class name="basic_opstream"><template>
1197       <template-type-parameter name="CharT"/>
1198       <template-type-parameter name="Traits"><default>std::char_traits&lt;CharT&gt;</default></template-type-parameter>
1199     </template><inherit access="public">std::basic_ostream&lt; CharT, Traits &gt;</inherit><description><para>Implementation of a write pipe stream. </para></description><typedef name="pipe_type"><type><classname>basic_pipe</classname>&lt; CharT, Traits &gt;</type></typedef>
1200 <typedef name="char_type"><type>CharT</type></typedef>
1201 <typedef name="traits_type"><type>Traits</type></typedef>
1202 <typedef name="int_type"><type>Traits::int_type</type></typedef>
1203 <typedef name="pos_type"><type>Traits::pos_type</type></typedef>
1204 <typedef name="off_type"><type>Traits::off_type</type></typedef>
1205 <method-group name="public member functions">
1206 <method name="rdbuf" cv="const"><type><classname>basic_pipebuf</classname>&lt; CharT, Traits &gt; *</type><purpose>Get access to the underlying stream_buf. </purpose></method>
1207 <method name="pipe"><type>void</type><parameter name="p"><paramtype><classname>pipe_type</classname> &amp;&amp;</paramtype></parameter><purpose>Set the pipe of the streambuf. </purpose></method>
1208 <method name="pipe"><type>void</type><parameter name="p"><paramtype>const <classname>pipe_type</classname> &amp;</paramtype></parameter><purpose>Set the pipe of the streambuf. </purpose></method>
1209 <method name="pipe"><type><classname>pipe_type</classname> &amp;</type><purpose>Get a reference to the pipe. </purpose></method>
1210 <method name="pipe" cv="const"><type>const <classname>pipe_type</classname> &amp;</type><purpose>Get a const reference to the pipe. </purpose></method>
1211 <method name="pipe"><type><classname>pipe_type</classname> &amp;&amp;</type><purpose>Get a rvalue reference to the pipe. Qualified as rvalue. </purpose></method>
1212 </method-group>
1213 <constructor><purpose>Default constructor. </purpose></constructor>
1214 <constructor cv="= delete"><parameter name=""><paramtype>const <classname>basic_opstream</classname> &amp;</paramtype></parameter><purpose>Copy constructor. </purpose></constructor>
1215 <constructor cv="= default"><parameter name=""><paramtype><classname>basic_opstream</classname> &amp;&amp;</paramtype></parameter><purpose>Move constructor. </purpose></constructor>
1216 <constructor><parameter name="p"><paramtype><classname>pipe_type</classname> &amp;&amp;</paramtype></parameter><purpose>Move construct from a pipe. </purpose></constructor>
1217 <constructor><parameter name="p"><paramtype>const <classname>pipe_type</classname> &amp;</paramtype></parameter><purpose>Copy construct from a pipe. </purpose></constructor>
1218 <copy-assignment cv="= delete"><type><classname>basic_opstream</classname> &amp;</type><parameter name=""><paramtype>const <classname>basic_opstream</classname> &amp;</paramtype></parameter><purpose>Copy assignment. </purpose></copy-assignment>
1219 <copy-assignment cv="= default"><type><classname>basic_opstream</classname> &amp;</type><parameter name=""><paramtype><classname>basic_opstream</classname> &amp;&amp;</paramtype></parameter><purpose>Move assignment. </purpose></copy-assignment>
1220 <copy-assignment><type><classname>basic_opstream</classname> &amp;</type><parameter name="p"><paramtype><classname>pipe_type</classname> &amp;&amp;</paramtype></parameter><purpose>Move assignment of a pipe. </purpose></copy-assignment>
1221 <copy-assignment><type><classname>basic_opstream</classname> &amp;</type><parameter name="p"><paramtype>const <classname>pipe_type</classname> &amp;</paramtype></parameter><purpose>Copy assignment of a pipe. </purpose></copy-assignment>
1222 </class><class name="basic_pstream"><template>
1223       <template-type-parameter name="CharT"/>
1224       <template-type-parameter name="Traits"><default>std::char_traits&lt;CharT&gt;</default></template-type-parameter>
1225     </template><inherit access="public">std::basic_iostream&lt; CharT, Traits &gt;</inherit><description><para>Implementation of a read-write pipe stream. </para></description><typedef name="pipe_type"><type><classname>basic_pipe</classname>&lt; CharT, Traits &gt;</type></typedef>
1226 <typedef name="char_type"><type>CharT</type></typedef>
1227 <typedef name="traits_type"><type>Traits</type></typedef>
1228 <typedef name="int_type"><type>Traits::int_type</type></typedef>
1229 <typedef name="pos_type"><type>Traits::pos_type</type></typedef>
1230 <typedef name="off_type"><type>Traits::off_type</type></typedef>
1231 <method-group name="public member functions">
1232 <method name="rdbuf" cv="const"><type><classname>basic_pipebuf</classname>&lt; CharT, Traits &gt; *</type><purpose>Get access to the underlying stream_buf. </purpose></method>
1233 <method name="pipe"><type>void</type><parameter name="p"><paramtype><classname>pipe_type</classname> &amp;&amp;</paramtype></parameter><purpose>Set the pipe of the streambuf. </purpose></method>
1234 <method name="pipe"><type>void</type><parameter name="p"><paramtype>const <classname>pipe_type</classname> &amp;</paramtype></parameter><purpose>Set the pipe of the streambuf. </purpose></method>
1235 <method name="pipe"><type><classname>pipe_type</classname> &amp;</type><purpose>Get a reference to the pipe. </purpose></method>
1236 <method name="pipe" cv="const"><type>const <classname>pipe_type</classname> &amp;</type><purpose>Get a const reference to the pipe. </purpose></method>
1237 <method name="pipe"><type><classname>pipe_type</classname> &amp;&amp;</type><purpose>Get a rvalue reference to the pipe. Qualified as rvalue. </purpose></method>
1238 </method-group>
1239 <constructor><purpose>Default constructor. </purpose></constructor>
1240 <constructor cv="= delete"><parameter name=""><paramtype>const <classname>basic_pstream</classname> &amp;</paramtype></parameter><purpose>Copy constructor. </purpose></constructor>
1241 <constructor cv="= default"><parameter name=""><paramtype><classname>basic_pstream</classname> &amp;&amp;</paramtype></parameter><purpose>Move constructor. </purpose></constructor>
1242 <constructor><parameter name="p"><paramtype><classname>pipe_type</classname> &amp;&amp;</paramtype></parameter><purpose>Move construct from a pipe. </purpose></constructor>
1243 <constructor><parameter name="p"><paramtype>const <classname>pipe_type</classname> &amp;</paramtype></parameter><purpose>Copy construct from a pipe. </purpose></constructor>
1244 <copy-assignment cv="= delete"><type><classname>basic_pstream</classname> &amp;</type><parameter name=""><paramtype>const <classname>basic_pstream</classname> &amp;</paramtype></parameter><purpose>Copy assignment. </purpose></copy-assignment>
1245 <copy-assignment cv="= default"><type><classname>basic_pstream</classname> &amp;</type><parameter name=""><paramtype><classname>basic_pstream</classname> &amp;&amp;</paramtype></parameter><purpose>Move assignment. </purpose></copy-assignment>
1246 <copy-assignment><type><classname>basic_pstream</classname> &amp;</type><parameter name="p"><paramtype><classname>pipe_type</classname> &amp;&amp;</paramtype></parameter><purpose>Move assignment of a pipe. </purpose></copy-assignment>
1247 <copy-assignment><type><classname>basic_pstream</classname> &amp;</type><parameter name="p"><paramtype>const <classname>pipe_type</classname> &amp;</paramtype></parameter><purpose>Copy assignment of a pipe. </purpose></copy-assignment>
1248 </class><typedef name="pipe"><type><classname>basic_pipe</classname>&lt; char &gt;</type></typedef>
1249 <typedef name="wpipe"><type><classname>basic_pipe</classname>&lt; wchar_t &gt;</type></typedef>
1250 <typedef name="pipebuf"><type><classname>basic_pipebuf</classname>&lt; char &gt;</type></typedef>
1251 <typedef name="wpipebuf"><type><classname>basic_pipebuf</classname>&lt; wchar_t &gt;</type></typedef>
1252 <typedef name="ipstream"><type><classname>basic_ipstream</classname>&lt; char &gt;</type></typedef>
1253 <typedef name="wipstream"><type><classname>basic_ipstream</classname>&lt; wchar_t &gt;</type></typedef>
1254 <typedef name="opstream"><type><classname>basic_opstream</classname>&lt; char &gt;</type></typedef>
1255 <typedef name="wopstream"><type><classname>basic_opstream</classname>&lt; wchar_t &gt;</type></typedef>
1256 <typedef name="pstream"><type><classname>basic_pstream</classname>&lt; char &gt;</type></typedef>
1257 <typedef name="wpstream"><type><classname>basic_pstream</classname>&lt; wchar_t &gt;</type></typedef>
1258
1259
1260
1261
1262
1263
1264
1265 </namespace>
1266 </namespace>
1267 </header>
1268 <header name="boost/process/posix.hpp">
1269 <para>Header which provides the posix extensions.  
1270 <programlisting language="c++">
1271 namespace boost {
1272   namespace process {
1273     namespace posix {
1274       <emphasis>unspecified</emphasis> <globalname alt="boost::process::posix::fd">fd</globalname>;
1275       <emphasis>unspecified</emphasis> <globalname alt="boost::process::posix::sig">sig</globalname>;
1276       <emphasis>unspecified</emphasis> <globalname alt="boost::process::posix::use_vfork">use_vfork</globalname>;
1277     }
1278   }
1279 }
1280 </programlisting>
1281      <warning><para>Only available on posix. See the documentation of <ulink url="http://pubs.opengroup.org/onlinepubs/009695399/functions/fork.html">fork</ulink>, <ulink url="http://pubs.opengroup.org/onlinepubs/009695399/functions/execve.html">execve</ulink> and <ulink url="http://pubs.opengroup.org/onlinepubs/009695399/functions/vfork.html">vfork</ulink>. </para></warning>
1282 </para><namespace name="boost">
1283 <namespace name="process">
1284 <namespace name="posix">
1285 <data-member name="fd"><type><emphasis>unspecified</emphasis></type><description><para>This property lets you modify file-descriptors other than the standard ones (0,1,2).</para><para>It provides the functions <computeroutput>bind</computeroutput>, which implements <ulink url="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup.html">dup2</ulink> and <ulink url="http://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html">close</ulink>.</para><para>Close can also be called with a range of file-descriptors to be closed. </para></description></data-member>
1286 <data-member name="sig"><type><emphasis>unspecified</emphasis></type><description><para>This property lets you modify the handling of <computeroutput>SIGCHLD</computeroutput> for this call. It will be reset afterwards.</para><para>It can be set to default, by the expression <computeroutput>sig.dfl()</computeroutput>, set to ignore with <computeroutput>sig.ign()</computeroutput> or assigned a custom handler. A custom handler must have the type <computeroutput>sighandler_t</computeroutput>and can be assigned with the following syntax:</para><para><programlisting language="c++">sig = handler;
1287 sig(handler);
1288 </programlisting></para><para><warning><para>spawn will automatically use <computeroutput>sig.ign()</computeroutput>, which will override if you pass a custom handler. </para></warning>
1289 </para></description></data-member>
1290 <data-member name="use_vfork"><type><emphasis>unspecified</emphasis></type><description><para>This property will replace the usage of <ulink url="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fork.html">fork</ulink> by <ulink url="http://pubs.opengroup.org/onlinepubs/009695399/functions/vfork.html">vfork</ulink>. <note><para><computeroutput>vfork</computeroutput> is no longer an official part of the posix standard. </para></note>
1291 </para></description></data-member>
1292 </namespace>
1293
1294
1295
1296
1297
1298
1299
1300 </namespace>
1301 </namespace>
1302 </header>
1303 <header name="boost/process/search_path.hpp">
1304 <para>Defines a function to search for an executable in path. </para><namespace name="boost">
1305 <namespace name="process">
1306
1307
1308
1309
1310 <function name="search_path"><type>boost::filesystem::path</type><parameter name="filename"><paramtype>const boost::filesystem::path &amp;</paramtype><description><para>The base of the filename to find</para></description></parameter><parameter name="path"><paramtype>const std::vector&lt; boost::filesystem::path &gt;</paramtype><default>::boost::this_process::path()</default><description><para>the set of paths so search, defaults to "PATH" environment variable.</para></description></parameter><description><para>Searches for an executable in path.</para><para>filename must be a basename including the file extension. It must not include any directory separators (like a slash). On Windows the file extension may be omitted. The function will then try the various file extensions for executables on Windows to find filename.</para><para>
1311
1312 </para></description><returns><para>the absolute path to the executable filename or an empty string if filename isn't found </para></returns></function>
1313
1314
1315 </namespace>
1316 </namespace>
1317 </header>
1318 <header name="boost/process/shell.hpp">
1319 <para>Header which provides the shell property. This provides the property to launch a process through the system shell. It also allows the user to obtain the shell-path via shell().  
1320 <programlisting language="c++">
1321 namespace boost {
1322   namespace process {
1323     <emphasis>unspecified</emphasis> <globalname alt="boost::process::shell">shell</globalname>;
1324   }
1325 }
1326 </programlisting>
1327  </para><namespace name="boost">
1328 <namespace name="process">
1329 <data-member name="shell"><type><emphasis>unspecified</emphasis></type><description><para>The shell property enables to launch a program through the shell of the system.</para><para><programlisting language="c++">system("gcc", shell);
1330 </programlisting></para><para>The shell argument goes without any expression. The operator() is overloaded, to obtain the path of the system shell.</para><para><programlisting language="c++">auto shell_cmd = shell();
1331 //avoid exceptions
1332 std::error_code ec;
1333 shell_cmd = shell(ec);
1334 </programlisting></para><para><note><para>Launching through the shell will NOT provide proper error handling, i.e. you will get an error via the return code.</para><para>Executing shell commands that incorporate unsanitized input from an untrusted source makes a program vulnerable to shell injection, a serious security flaw which can result in arbitrary command execution. For this reason, the use of <computeroutput>shell</computeroutput> is strongly discouraged in cases where the command string is constructed from external input: </para></note>
1335 </para></description></data-member>
1336
1337
1338
1339
1340
1341
1342
1343 </namespace>
1344 </namespace>
1345 </header>
1346 <header name="boost/process/spawn.hpp">
1347 <para>Defines the spawn function. </para><namespace name="boost">
1348 <namespace name="process">
1349
1350
1351
1352
1353
1354 <function name="spawn"><type>void</type><template>
1355           <template-nontype-parameter name="Args"><type>typename...</type></template-nontype-parameter>
1356         </template><parameter name="args"><paramtype>Args &amp;&amp;...</paramtype></parameter><description><para>Launch a process and detach it. Returns no handle.</para><para>This function starts a process and immediately detaches it. It thereby prevents the system from creating a zombie process, but will also cause the system to be unable to wait for the child to exit.</para><para><note><para>This will set <computeroutput>SIGCHLD</computeroutput> to <computeroutput>SIGIGN</computeroutput> on posix.</para></note>
1357 <warning><para>This function does not allow asynchronous operations, since it cannot wait for the end of the process. It will fail to compile if a reference to <computeroutput>boost::asio::io_service</computeroutput> is passed. </para></warning>
1358 </para></description></function>
1359
1360 </namespace>
1361 </namespace>
1362 </header>
1363 <header name="boost/process/start_dir.hpp">
1364 <para>Header which provides the start_dir property, which allows to set the directory the process shall be started in.  
1365 <programlisting language="c++">
1366 namespace boost {
1367   namespace process {
1368     <emphasis>unspecified</emphasis> <globalname alt="boost::process::start_dir">start_dir</globalname>;
1369   }
1370 }
1371 </programlisting>
1372  </para><namespace name="boost">
1373 <namespace name="process">
1374 <data-member name="start_dir"><type><emphasis>unspecified</emphasis></type><description><para>To set the start dir, the <computeroutput>start_dir</computeroutput> property is provided.</para><para>The valid operations are the following:</para><para><programlisting language="c++">start_dir=path
1375 start_dir(path)
1376 </programlisting></para><para>It can be used with <computeroutput>std::string</computeroutput>, <computeroutput>std::wstring</computeroutput> and <computeroutput>boost::filesystem::path</computeroutput>. </para></description></data-member>
1377
1378
1379
1380
1381
1382
1383
1384 </namespace>
1385 </namespace>
1386 </header>
1387 <header name="boost/process/system.hpp">
1388 <para>Defines a system function. </para><namespace name="boost">
1389 <namespace name="process">
1390
1391
1392
1393
1394
1395
1396 <function name="system"><type>int</type><template>
1397           <template-nontype-parameter name="Args"><type>typename...</type></template-nontype-parameter>
1398         </template><parameter name="args"><paramtype>Args &amp;&amp;...</paramtype></parameter><description><para>Launches a process and waits for its exit. It works as std::system, though it allows all the properties boost.process provides. It will execute the process and wait for it's exit; then return the exit_code.</para><para><programlisting language="c++">int ret = system("ls");
1399 </programlisting></para><para><note><para>Using this function with synchronous pipes leads to many potential deadlocks.</para></note>
1400 When using this function with an asynchronous properties and NOT passing an io_service object, the system function will create one and run it. When the io_service is passed to the function, the system function will check if it is active, and call the io_service::run function if not. </para></description></function>
1401 </namespace>
1402 </namespace>
1403 </header>
1404 <header name="boost/process/windows.hpp">
1405 <para>Header which provides the windows extensions.</para><para> 
1406 <programlisting language="c++">
1407 namespace boost {
1408   namespace process {
1409     namespace windows {
1410       <emphasis>unspecified</emphasis> <globalname alt="boost::process::windows::hide">hide</globalname>;
1411       <emphasis>unspecified</emphasis> <globalname alt="boost::process::windows::maximized">maximized</globalname>;
1412       <emphasis>unspecified</emphasis> <globalname alt="boost::process::windows::minimized">minimized</globalname>;
1413       <emphasis>unspecified</emphasis> <globalname alt="boost::process::windows::minimized_not_active">minimized_not_active</globalname>;
1414       <emphasis>unspecified</emphasis> <globalname alt="boost::process::windows::not_active">not_active</globalname>;
1415       <emphasis>unspecified</emphasis> <globalname alt="boost::process::windows::show">show</globalname>;
1416       <emphasis>unspecified</emphasis> <globalname alt="boost::process::windows::show_normal">show_normal</globalname>;
1417     }
1418   }
1419 }
1420 </programlisting>
1421      <warning><para>Only available on windows. See the parameter documentation of <ulink url="https://msdn.microsoft.com/en-us/library/windows/desktop/ms633548.aspx">ShowWindow</ulink> for more details. </para></warning>
1422 </para><namespace name="boost">
1423 <namespace name="process">
1424 <namespace name="windows">
1425 <data-member name="hide"><type><emphasis>unspecified</emphasis></type><purpose>Hides the window and activates another window. </purpose></data-member>
1426 <data-member name="maximized"><type><emphasis>unspecified</emphasis></type><purpose>Activates the window and displays it as a maximized window. </purpose></data-member>
1427 <data-member name="minimized"><type><emphasis>unspecified</emphasis></type><purpose>Activates the window and displays it as a minimized window. </purpose></data-member>
1428 <data-member name="minimized_not_active"><type><emphasis>unspecified</emphasis></type><purpose>Displays the window as a minimized window. This value is similar to <computeroutput>minimized</computeroutput>, except the window is not activated. </purpose></data-member>
1429 <data-member name="not_active"><type><emphasis>unspecified</emphasis></type><purpose>Displays a window in its most recent size and position. This value is similar to show_normal`, except that the window is not activated. </purpose></data-member>
1430 <data-member name="show"><type><emphasis>unspecified</emphasis></type><purpose>Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time. </purpose></data-member>
1431 <data-member name="show_normal"><type><emphasis>unspecified</emphasis></type><purpose>Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time. </purpose></data-member>
1432 </namespace>
1433
1434
1435
1436
1437
1438
1439
1440 </namespace>
1441 </namespace>
1442 </header>
1443 </library-reference>