autodoc.xml 144 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757
  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>
  21. <para><programlisting language="c++">args = value;
  22. args(value);
  23. </programlisting></para>
  24. <para><computeroutput>std::initializer_list</computeroutput> is among the allowed types, so the following syntax is also possible.</para>
  25. <para><programlisting language="c++">args = {value1, value2};
  26. args({value1, value2});
  27. </programlisting></para>
  28. <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>
  29. <sect4 id="namespaceboost_1_1process_1args_set_var_value">
  30. <title>value</title>
  31. <para><itemizedlist>
  32. <listitem><para><computeroutput>std::basic_string&lt;char_type&gt;</computeroutput></para>
  33. </listitem><listitem><para><computeroutput>const char_type *</computeroutput></para>
  34. </listitem><listitem><para><computeroutput>std::initializer_list&lt;const char_type *&gt;</computeroutput></para>
  35. </listitem><listitem><para><computeroutput>std::vector&lt;std::basic_string&lt;char_type&gt;&gt;</computeroutput></para>
  36. </listitem></itemizedlist>
  37. </para>
  38. <para>Additionally any range of <computeroutput>std::basic_string&lt;char_type&gt;</computeroutput> can be passed.</para>
  39. </sect4>
  40. </sect3>
  41. <sect3 id="namespaceboost_1_1process_1args_append_var">
  42. <title>Appending values</title>
  43. <para>To append a the argument vector the following syntax can be used.</para>
  44. <para><programlisting language="c++">args += value;
  45. </programlisting></para>
  46. <para><computeroutput>std::initializer_list</computeroutput> is among the allowed types, so the following syntax is also possible.</para>
  47. <para><programlisting language="c++">args += {value1, value2};
  48. </programlisting></para>
  49. <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>
  50. <sect4 id="namespaceboost_1_1process_1args_append_var_value">
  51. <title>value</title>
  52. <para><itemizedlist>
  53. <listitem><para><computeroutput>std::basic_string&lt;char_type&gt;</computeroutput></para>
  54. </listitem><listitem><para><computeroutput>const char_type *</computeroutput></para>
  55. </listitem><listitem><para><computeroutput>std::initializer_list&lt;const char_type *&gt;</computeroutput></para>
  56. </listitem><listitem><para><computeroutput>std::vector&lt;std::basic_string&lt;char_type&gt;&gt;</computeroutput></para>
  57. </listitem></itemizedlist>
  58. </para>
  59. <para>Additionally any range of <computeroutput>std::basic_string&lt;char_type&gt;</computeroutput> can be passed.</para>
  60. </sect4>
  61. </sect3>
  62. </sect2>
  63. <sect2 id="namespaceboost_1_1process_1args_example">
  64. <title>Example</title>
  65. <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>
  66. <para><programlisting language="c++">spawn("gcc", "--version");
  67. spawn("gcc", args ="--version");
  68. spawn("gcc", args+="--version");
  69. spawn("gcc", args ={"--version"});
  70. spawn("gcc", args+={"--version"});
  71. </programlisting></para>
  72. <para><note><para>A string will be parsed and set in quotes if it has none and contains spaces. </para>
  73. </note>
  74. </para>
  75. </sect2>
  76. </sect1></description></data-member>
  77. <data-member name="argv"><type><emphasis>unspecified</emphasis></type><purpose>Alias for <globalname alt="boost::process::args">args</globalname> . </purpose></data-member>
  78. </namespace>
  79. </namespace>
  80. </header>
  81. <header name="boost/process/async.hpp">
  82. <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_context, 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>
  83. <programlisting language="c++">
  84. namespace boost {
  85. namespace process {
  86. <emphasis>unspecified</emphasis> <ulink url="http://www.boost.org/doc/libs/1_61_0/doc/html/boost_asio/reference/buffer.html">buffer</ulink>;
  87. <emphasis>unspecified</emphasis> <globalname alt="boost::process::on_exit">on_exit</globalname>;
  88. }
  89. }
  90. </programlisting>
  91. </para><namespace name="boost">
  92. <namespace name="process">
  93. <data-member name="on_exit" specifiers="static"><type><emphasis>unspecified</emphasis></type><description><para>When an io_context 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;
  94. on_exit(function);
  95. </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/>
  96. </formalpara>
  97. <programlisting language="c++">io_context ios;
  98. child c("ls", on_exit=[](int exit, const std::error_code&amp; ec_in){});
  99. std::future&lt;int&gt; exit_code;
  100. chlid c2("ls", on_exit=exit_code);
  101. </programlisting></para><para><note><para>The handler is not invoked when the launch fails. </para>
  102. </note>
  103. <warning><para>When used ignore_error it might get invoked on error. </para>
  104. </warning>
  105. <warning><para><computeroutput>on_exit</computeroutput> uses <computeroutput>boost::asio::signal_set</computeroutput> to listen for <computeroutput>SIGCHLD</computeroutput> on posix, and so has the same restrictions as that class (do not register a handler for <computeroutput>SIGCHLD</computeroutput> except by using <computeroutput>boost::asio::signal_set</computeroutput>). </para>
  106. </warning>
  107. </para></description></data-member>
  108. </namespace>
  109. </namespace>
  110. </header>
  111. <header name="boost/process/async_pipe.hpp">
  112. <namespace name="boost">
  113. <namespace name="process">
  114. <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>
  115. </note>
  116. </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>
  117. </note>
  118. </para></description><type>platform_specific</type></typedef>
  119. <typedef name="handle_type"><description><para>Typedef for the handle representation of boost.asio. </para></description><type>platform_specific</type></typedef>
  120. <method-group name="public member functions">
  121. <method name="conversion-operator" cv="const" specifiers="explicit"><type>basic_pipe&lt; CharT, Traits &gt;</type><template>
  122. <template-type-parameter name="CharT"/>
  123. <template-type-parameter name="Traits"><default>std::char_traits&lt;CharT&gt;</default></template-type-parameter>
  124. </template><description><para>Explicit cast to <classname alt="boost::process::basic_pipe">basic_pipe</classname>. </para></description></method>
  125. <method name="cancel"><type>void</type><description><para>Cancel the current asynchronous operations. </para></description></method>
  126. <method name="close"><type>void</type><description><para>Close the pipe handles. </para></description></method>
  127. <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>
  128. <method name="is_open" cv="const"><type>bool</type><description><para>Check if the pipes are open. </para></description></method>
  129. <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>
  130. </note>
  131. </para></description></method>
  132. <method name="read_some"><type>std::size_t</type><template>
  133. <template-type-parameter name="MutableBufferSequence"/>
  134. </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>
  135. <method name="write_some"><type>std::size_t</type><template>
  136. <template-type-parameter name="MutableBufferSequence"/>
  137. </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>
  138. <method name="native_source" cv="const"><type>native_handle</type><description><para>Get the native handle of the source. </para></description></method>
  139. <method name="native_sink" cv="const"><type>native_handle</type><description><para>Get the native handle of the sink. </para></description></method>
  140. <method name="async_read_some"><type><emphasis>unspecified</emphasis></type><template>
  141. <template-type-parameter name="MutableBufferSequence"/>
  142. <template-type-parameter name="ReadHandler"/>
  143. </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>
  144. <method name="async_write_some"><type><emphasis>unspecified</emphasis></type><template>
  145. <template-type-parameter name="ConstBufferSequence"/>
  146. <template-type-parameter name="WriteHandler"/>
  147. </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>
  148. <method name="sink" cv="const"><type>const handle_type &amp;</type><purpose>Get the asio handle of the pipe sink. </purpose></method>
  149. <method name="source" cv="const"><type>const handle_type &amp;</type><purpose>Get the asio handle of the pipe source. </purpose></method>
  150. <method name="sink"><type>handle_type &amp;&amp;</type><purpose>Get the asio handle of the pipe sink. Qualified as rvalue. </purpose></method>
  151. <method name="source"><type>handle_type &amp;&amp;</type><purpose>Get the asio handle of the pipe source. Qualified as rvalue. </purpose></method>
  152. <method name="source"><type>handle_type</type><parameter name="ios"><paramtype>::boost::asio::io_context &amp;</paramtype></parameter><purpose>Move the source out of this class and change the io_context. Qualified as rvalue. </purpose><description><para><note><para>Will always move. </para>
  153. </note>
  154. </para></description></method>
  155. <method name="sink"><type>handle_type</type><parameter name="ios"><paramtype>::boost::asio::io_context &amp;</paramtype></parameter><purpose>Move the sink out of this class and change the io_context. Qualified as rvalue. </purpose><description><para><note><para>Will always move </para>
  156. </note>
  157. </para></description></method>
  158. <method name="source" cv="const"><type>handle_type</type><parameter name="ios"><paramtype>::boost::asio::io_context &amp;</paramtype></parameter><purpose>Copy the source out of this class and change the io_context. </purpose><description><para><note><para>Will always copy. </para>
  159. </note>
  160. </para></description></method>
  161. <method name="sink" cv="const"><type>handle_type</type><parameter name="ios"><paramtype>::boost::asio::io_context &amp;</paramtype></parameter><purpose>Copy the sink out of this class and change the io_context. </purpose><description><para><note><para>Will always copy </para>
  162. </note>
  163. </para></description></method>
  164. </method-group>
  165. <constructor><parameter name="ios"><paramtype>boost::asio::io_context &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_context. <note><para>Windows creates a named pipe here, where the name is automatically generated. </para>
  166. </note>
  167. </para></description></constructor>
  168. <constructor><parameter name="ios_source"><paramtype>boost::asio::io_context &amp;</paramtype></parameter><parameter name="ios_sink"><paramtype>boost::asio::io_context &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>
  169. </note>
  170. </para></description></constructor>
  171. <constructor><parameter name="ios"><paramtype>boost::asio::io_context &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_context.</para><para><note><para>Windows restricts possible names. </para>
  172. </note>
  173. </para></description></constructor>
  174. <constructor><parameter name="ios_source"><paramtype>boost::asio::io_context &amp;</paramtype></parameter><parameter name="ios_sink"><paramtype>boost::asio::io_context &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>
  175. </note>
  176. </para></description></constructor>
  177. <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>
  178. </note>
  179. </para></description></constructor>
  180. <constructor><parameter name="lhs"><paramtype><classname>async_pipe</classname> &amp;&amp;</paramtype></parameter><description><para>Move-Constructor of the async pipe. </para></description></constructor>
  181. <constructor specifiers="explicit"><template>
  182. <template-type-parameter name="CharT"/>
  183. <template-type-parameter name="Traits"><default>std::char_traits&lt;CharT&gt;</default></template-type-parameter>
  184. </template><parameter name="ios"><paramtype>boost::asio::io_context &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>
  185. </note>
  186. </para></description></constructor>
  187. <constructor specifiers="explicit"><template>
  188. <template-type-parameter name="CharT"/>
  189. <template-type-parameter name="Traits"><default>std::char_traits&lt;CharT&gt;</default></template-type-parameter>
  190. </template><parameter name="ios_source"><paramtype>boost::asio::io_context &amp;</paramtype></parameter><parameter name="ios_sink"><paramtype>boost::asio::io_context &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_context objects. <note><para>Windows requires a named pipe for this, if a the wrong type is used an exception is thrown. </para>
  191. </note>
  192. </para></description></constructor>
  193. <copy-assignment><type><classname>async_pipe</classname> &amp;</type><template>
  194. <template-type-parameter name="CharT"/>
  195. <template-type-parameter name="Traits"><default>std::char_traits&lt;CharT&gt;</default></template-type-parameter>
  196. </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>
  197. </note>
  198. </para></description></copy-assignment>
  199. <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>
  200. </note>
  201. </para></description></copy-assignment>
  202. <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>
  203. <destructor><description><para>Destructor. Closes the pipe handles. </para></description></destructor>
  204. </class>
  205. </namespace>
  206. </namespace>
  207. </header>
  208. <header name="boost/process/async_system.hpp">
  209. <para>Defines the asynchrounous version of the system function. </para><namespace name="boost">
  210. <namespace name="process">
  211. <function name="async_system"><type><emphasis>unspecified</emphasis></type><template>
  212. <template-type-parameter name="ExitHandler"/>
  213. <template-nontype-parameter name="Args"><type>typename ...</type></template-nontype-parameter>
  214. </template><parameter name="ios"><paramtype>boost::asio::io_context &amp;</paramtype><description><para>A reference to an <ulink url="http://www.boost.org/doc/libs/release/doc/html/boost_asio/reference.html">io_context</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>
  215. <note><para>This function does not allow custom error handling, since those are done through the <computeroutput>exit_handler</computeroutput>. </para>
  216. </note>
  217. </para></description></function>
  218. </namespace>
  219. </namespace>
  220. </header>
  221. <header name="boost/process/child.hpp">
  222. <para>Defines a child process class. </para><namespace name="boost">
  223. <namespace name="process">
  224. <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>
  225. </note>
  226. </para></description><method-group name="private member functions">
  227. <method name="detach"><type>void</type><description><para>Detach the child, i.e. let it run after this handle dies. </para></description></method>
  228. <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>
  229. <method name="joinable"><type>bool</type><description><para>Check if the child is joinable. </para></description></method>
  230. <method name="native_handle" cv="const"><type>native_handle_t</type><description><para>Get the native handle for the child process. </para></description></method>
  231. <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>
  232. <method name="id" cv="const"><type>pid_t</type><description><para>Get the Process Identifier. </para></description></method>
  233. <method name="native_exit_code" cv="const"><type>int</type><description><para>Get the native, uninterpreted exit code. The return value is without any meaning if the child wasn't waited for or if it was terminated. </para></description></method>
  234. <method name="running"><type>bool</type><description><para>Check if the child process is running. </para></description></method>
  235. <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>
  236. <method name="wait"><type>void</type><description><para>Wait for the child process to exit. </para></description></method>
  237. <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>
  238. <method name="wait_for"><type>bool</type><template>
  239. <template-type-parameter name="Rep"/>
  240. <template-type-parameter name="Period"/>
  241. </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.
  242. </para></description><returns><para>True if child exited while waiting. </para>
  243. </returns></method>
  244. <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>
  245. <method name="wait_until"><type>bool</type><template>
  246. <template-type-parameter name="Clock"/>
  247. <template-type-parameter name="Duration"/>
  248. </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.
  249. </para></description><returns><para>True if child exited while waiting. </para>
  250. </returns></method>
  251. <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>
  252. <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>
  253. </note>
  254. </para></description></method>
  255. <method name="conversion-operator" cv="const" specifiers="explicit"><type>bool</type><description><para>Same as valid, for convenience. </para></description></method>
  256. <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>
  257. <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>
  258. <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>
  259. <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>
  260. </method-group>
  261. <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>
  262. </note>
  263. </para></description></constructor>
  264. <constructor><parameter name="lhs"><paramtype><classname>child</classname> &amp;&amp;</paramtype></parameter><description><para>Move-Constructor. </para></description></constructor>
  265. <constructor specifiers="explicit"><template>
  266. <template-nontype-parameter name="Args"><type>typename ...</type></template-nontype-parameter>
  267. </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>
  268. <constructor cv="= default"><description><para>Construct an empty child. </para></description></constructor>
  269. <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>
  270. <destructor><description><para>Destructor. <note><para>Will call terminate (without warning) when the child was neither joined nor detached. </para>
  271. </note>
  272. </para></description></destructor>
  273. </class><typedef name="pid_t"><purpose>Typedef for the type of an pid_t. </purpose><type><emphasis>unspecified</emphasis></type></typedef>
  274. </namespace>
  275. </namespace>
  276. </header>
  277. <header name="boost/process/cmd.hpp">
  278. <para>This header provides the <globalname alt="boost::process::cmd">cmd</globalname> property.</para><para>
  279. <programlisting language="c++">
  280. namespace boost {
  281. namespace process {
  282. <emphasis>unspecified</emphasis> <globalname alt="boost::process::cmd">cmd</globalname>;
  283. }
  284. }
  285. </programlisting>
  286. </para><namespace name="boost">
  287. <namespace name="process">
  288. <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";
  289. cmd(value);
  290. </programlisting></para><para>The property can only be used for assignments. </para></description></data-member>
  291. </namespace>
  292. </namespace>
  293. </header>
  294. <header name="boost/process/env.hpp">
  295. <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>
  296. <programlisting language="c++">
  297. namespace boost {
  298. namespace process {
  299. <emphasis>unspecified</emphasis> <globalname alt="boost::process::env">env</globalname>;
  300. }
  301. }
  302. </programlisting>
  303. </para><para>For additional information see the platform documentations:</para><para><itemizedlist>
  304. <listitem><para><ulink url="https://msdn.microsoft.com/en-US/library/windows/desktop/ms682653.aspx">windows</ulink></para>
  305. </listitem><listitem><para><ulink url="http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html">posix</ulink> </para>
  306. </listitem></itemizedlist>
  307. </para><namespace name="boost">
  308. <namespace name="process">
  309. <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 ':' separated 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, separated 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">
  310. <title>Details</title>
  311. <sect2 id="namespaceboost_1_1process_1env_operations">
  312. <title>Operations</title>
  313. <sect3 id="namespaceboost_1_1process_1env_set_var">
  314. <title>Setting variables</title>
  315. <para>To set a variable <computeroutput>id</computeroutput> the value <computeroutput>value</computeroutput> the following syntax can be used.</para>
  316. <para><programlisting language="c++">env[id] = value;
  317. env(id, value);
  318. </programlisting></para>
  319. <para><computeroutput>std::initializer_list</computeroutput> is among the allowed types, so the following syntax is also possible.</para>
  320. <para><programlisting language="c++">env[id] = {value1, value2};
  321. env(id, {value1, value2});
  322. </programlisting></para>
  323. <para><note><para>Creates the variable if it does not exist.</para>
  324. </note>
  325. 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>
  326. <sect4 id="namespaceboost_1_1process_1id">
  327. <title>id</title>
  328. <para><itemizedlist>
  329. <listitem><para><computeroutput>std::basic_string&lt;char_type&gt;</computeroutput></para>
  330. </listitem><listitem><para><computeroutput>const char_type *</computeroutput></para>
  331. </listitem></itemizedlist>
  332. </para>
  333. </sect4>
  334. <sect4 id="namespaceboost_1_1process_1env_set_var_value">
  335. <title>value</title>
  336. <para><itemizedlist>
  337. <listitem><para><computeroutput>std::basic_string&lt;char_type&gt;</computeroutput></para>
  338. </listitem><listitem><para><computeroutput>const char_type *</computeroutput></para>
  339. </listitem><listitem><para><computeroutput>std::initializer_list&lt;const char_type *&gt;</computeroutput></para>
  340. </listitem><listitem><para><computeroutput>std::vector&lt;std::basic_string&lt;char_type&gt;&gt;</computeroutput></para>
  341. </listitem></itemizedlist>
  342. </para>
  343. <para><note><para>Using <computeroutput>std::vector</computeroutput> or <computeroutput>std::initializer_list</computeroutput></para>
  344. </note>
  345. </para>
  346. </sect4>
  347. </sect3>
  348. <sect3 id="namespaceboost_1_1process_1env_append_var">
  349. <title>Append variables</title>
  350. <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>
  351. <para><programlisting language="c++">env[id] += value;
  352. </programlisting></para>
  353. <para><computeroutput>std::initializer_list</computeroutput> is among the allowed types, so the following syntax is also possible.</para>
  354. <para><programlisting language="c++">env[id] += {value1, value2};
  355. </programlisting></para>
  356. <para><note><para>Creates the variable if it does not exist.</para>
  357. </note>
  358. 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>
  359. <sect4 id="namespaceboost_1_1process_1env_append_var_id">
  360. <title>id</title>
  361. <para><itemizedlist>
  362. <listitem><para><computeroutput>std::basic_string&lt;char_type&gt;</computeroutput></para>
  363. </listitem><listitem><para><computeroutput>const char_type *</computeroutput></para>
  364. </listitem></itemizedlist>
  365. </para>
  366. </sect4>
  367. <sect4 id="namespaceboost_1_1process_1env_append_var_value">
  368. <title>value</title>
  369. <para><itemizedlist>
  370. <listitem><para><computeroutput>std::basic_string&lt;char_type&gt;</computeroutput></para>
  371. </listitem><listitem><para><computeroutput>const char_type *</computeroutput></para>
  372. </listitem><listitem><para><computeroutput>std::initializer_list&lt;const char_type *&gt;</computeroutput></para>
  373. </listitem><listitem><para><computeroutput>std::vector&lt;std::basic_string&lt;char_type&gt;&gt;</computeroutput></para>
  374. </listitem></itemizedlist>
  375. </para>
  376. </sect4>
  377. </sect3>
  378. <sect3 id="namespaceboost_1_1process_1env_reset">
  379. <title>Reset variables</title>
  380. <para>Reseting signle variables can be done in the following way:</para>
  381. <para><programlisting language="c++">env[id] = boost::none;
  382. env(id, boost::none);
  383. </programlisting></para>
  384. <para><note><para>This does not set the value empty, but removes it from the list.</para>
  385. </note>
  386. The following lists contain possible value types, with <computeroutput>char_type</computeroutput> being either <computeroutput>char</computeroutput> or <computeroutput>wchar_t</computeroutput>:</para>
  387. <sect4 id="namespaceboost_1_1process_1env_reset_var_id">
  388. <title>id</title>
  389. <para><itemizedlist>
  390. <listitem><para><computeroutput>std::basic_string&lt;char_type&gt;</computeroutput></para>
  391. </listitem><listitem><para><computeroutput>const char_type *</computeroutput></para>
  392. </listitem></itemizedlist>
  393. </para>
  394. </sect4>
  395. </sect3>
  396. <sect3 id="namespaceboost_1_1process_1env_init">
  397. <title>Initialize the environment</title>
  398. <para>The whole environment can be initialized from an object of type <classname>boost::process::environment</classname> </para>
  399. <para><programlisting language="c++">env=env;
  400. env(env);
  401. </programlisting></para>
  402. <para><note><para>The passed <computeroutput>environment</computeroutput> can also be default-constructed to get an empty environment.</para>
  403. </note>
  404. </para>
  405. <sect4 id="namespaceboost_1_1process_1env_init_var_id">
  406. <title>id</title>
  407. <para><itemizedlist>
  408. <listitem><para><computeroutput>std::basic_string&lt;char_type&gt;</computeroutput></para>
  409. </listitem><listitem><para><computeroutput>const char_type *</computeroutput></para>
  410. </listitem></itemizedlist>
  411. </para>
  412. </sect4>
  413. <sect4 id="namespaceboost_1_1process_1env_init_var_value">
  414. <title>value</title>
  415. <para><itemizedlist>
  416. <listitem><para><computeroutput><classname alt="boost::process::basic_environment">boost::process::basic_environment</classname>&lt;char_type&gt;</computeroutput></para>
  417. </listitem></itemizedlist>
  418. </para>
  419. </sect4>
  420. </sect3>
  421. </sect2>
  422. <sect2 id="namespaceboost_1_1process_1env_example">
  423. <title>Example</title>
  424. <para><programlisting language="c++">spawn("b2", env["PATH"]+="F:/boost", env["SOME_VAR"]=boost::none, env["NEW_VAR"]="VALUE");
  425. </programlisting></para>
  426. <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>
  427. <para><programlisting language="c++">environment e = this_process::environment();
  428. e["PATH"] += "F:/boost";
  429. e.erase("SOME_VAR");
  430. e["NEW_VAR"] = "VALUE";
  431. spawn("b2", e);
  432. </programlisting></para>
  433. <para><warning><para>Passing an empty environment will cause undefined behaviour. </para>
  434. </warning>
  435. </para>
  436. </sect2>
  437. </sect1></description></data-member>
  438. </namespace>
  439. </namespace>
  440. </header>
  441. <header name="boost/process/environment.hpp">
  442. <namespace name="boost">
  443. <namespace name="process">
  444. <class name="basic_environment"><template>
  445. <template-type-parameter name="Char"/>
  446. </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>
  447. <template-type-parameter name="Char"/>
  448. <template-type-parameter name="Environment"/>
  449. </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>
  450. </note>
  451. </para></description><typedef name="value_type"><type>Char</type></typedef>
  452. <typedef name="pointer"><type>const value_type *</type></typedef>
  453. <typedef name="string_type"><type>std::basic_string&lt; value_type &gt;</type></typedef>
  454. <typedef name="range"><type>boost::iterator_range&lt; pointer &gt;</type></typedef>
  455. <typedef name="environment_t"><type>Environment</type></typedef>
  456. <method-group name="public member functions">
  457. <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>
  458. <method name="const_entry" cv="= default"><type/><parameter name=""><paramtype>const const_entry &amp;</paramtype></parameter><purpose>Copy Constructor. </purpose></method>
  459. <method name="empty" cv="const"><type>bool</type><purpose>Check if the entry is empty. </purpose></method>
  460. </method-group>
  461. <copy-assignment cv="= default"><type>const_entry &amp;</type><parameter name=""><paramtype>const const_entry &amp;</paramtype></parameter><purpose>Move Constructor. </purpose></copy-assignment>
  462. </struct><struct name="entry_type"><template>
  463. <template-type-parameter name="Char"/>
  464. <template-type-parameter name="Environment"/>
  465. </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>
  466. </note>
  467. </para></description><typedef name="value_type"><type>Char</type></typedef>
  468. <typedef name="pointer"><type>const value_type *</type></typedef>
  469. <typedef name="string_type"><type>std::basic_string&lt; value_type &gt;</type></typedef>
  470. <typedef name="range"><type>boost::iterator_range&lt; pointer &gt;</type></typedef>
  471. <typedef name="environment_t"><type>Environment</type></typedef>
  472. <method-group name="public member functions">
  473. <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>
  474. <method name="entry" cv="= default"><type/><parameter name=""><paramtype>const entry &amp;</paramtype></parameter><purpose>Copy Constructor. </purpose></method>
  475. <method name="empty" cv="const"><type>bool</type><purpose>Check if the entry is empty. </purpose></method>
  476. <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>
  477. <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 separated by ';' or ':'. </purpose></method>
  478. <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 separated by ';' or ':'. </purpose></method>
  479. <method name="clear"><type>void</type><purpose>Reset the value. </purpose></method>
  480. <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 separated by ';' or ':'. </purpose></method>
  481. </method-group>
  482. <copy-assignment cv="= default"><type>entry &amp;</type><parameter name=""><paramtype>const entry &amp;</paramtype></parameter><purpose>Move Constructor. </purpose></copy-assignment>
  483. <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>
  484. <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 separated by ';' or ':'. </purpose></copy-assignment>
  485. </struct><typedef name="string_type"><type>std::basic_string&lt; Char &gt;</type></typedef>
  486. <typedef name="iterator"><type>boost::transform_iterator&lt; entry_maker, Char ** &gt;</type></typedef>
  487. <typedef name="const_iterator"><type>boost::transform_iterator&lt; const_entry_maker, Char ** &gt;</type></typedef>
  488. <typedef name="size_type"><type>std::size_t</type></typedef>
  489. <typedef name="native_handle"><type><emphasis>unspecified</emphasis></type></typedef>
  490. <typedef name="base_type"><type><emphasis>unspecified</emphasis></type></typedef>
  491. <method-group name="public member functions">
  492. <method name="begin"><type>iterator</type><purpose>Returns an iterator to the beginning. </purpose></method>
  493. <method name="begin" cv="const"><type>const_iterator</type><purpose>Returns an iterator to the beginning. </purpose></method>
  494. <method name="cbegin" cv="const"><type>const_iterator</type><purpose>Returns an iterator to the beginning. </purpose></method>
  495. <method name="end"><type>iterator</type><purpose>Returns an iterator to the end. </purpose></method>
  496. <method name="end" cv="const"><type>const_iterator</type><purpose>Returns an iterator to the end. </purpose></method>
  497. <method name="cend" cv="const"><type>const_iterator</type><purpose>Returns an iterator to the end. </purpose></method>
  498. <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>
  499. <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>
  500. <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>
  501. <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>
  502. <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>
  503. <method name="empty"><type>bool</type><purpose>Check if environment has entries. </purpose></method>
  504. <method name="size" cv="const"><type>std::size_t</type><purpose>Get the number of variables. </purpose></method>
  505. <method name="clear"><type>void</type><purpose>Clear the environment. </purpose><description><para><note><para>Use with care, passed environment cannot be empty. </para>
  506. </note>
  507. </para></description></method>
  508. <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>
  509. <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>
  510. <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>
  511. </method-group>
  512. <constructor><purpose>Default constructor. </purpose></constructor>
  513. <constructor><parameter name=""><paramtype>const <classname>basic_environment</classname> &amp;</paramtype></parameter><purpose>Copy constructor. </purpose></constructor>
  514. <constructor><parameter name=""><paramtype><classname>basic_environment</classname> &amp;&amp;</paramtype></parameter><purpose>Move constructor. </purpose></constructor>
  515. <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>
  516. <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>
  517. </class><class name="basic_native_environment"><template>
  518. <template-type-parameter name="Char"/>
  519. </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>
  520. <template-type-parameter name="Char"/>
  521. <template-type-parameter name="Environment"/>
  522. </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>
  523. </note>
  524. </para></description><typedef name="value_type"><type>Char</type></typedef>
  525. <typedef name="pointer"><type>const value_type *</type></typedef>
  526. <typedef name="string_type"><type>std::basic_string&lt; value_type &gt;</type></typedef>
  527. <typedef name="range"><type>boost::iterator_range&lt; pointer &gt;</type></typedef>
  528. <typedef name="environment_t"><type>Environment</type></typedef>
  529. <method-group name="public member functions">
  530. <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>
  531. <method name="const_entry" cv="= default"><type/><parameter name=""><paramtype>const const_entry &amp;</paramtype></parameter><purpose>Copy Constructor. </purpose></method>
  532. <method name="empty" cv="const"><type>bool</type><purpose>Check if the entry is empty. </purpose></method>
  533. </method-group>
  534. <copy-assignment cv="= default"><type>const_entry &amp;</type><parameter name=""><paramtype>const const_entry &amp;</paramtype></parameter><purpose>Move Constructor. </purpose></copy-assignment>
  535. </struct><struct name="entry_type"><template>
  536. <template-type-parameter name="Char"/>
  537. <template-type-parameter name="Environment"/>
  538. </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>
  539. </note>
  540. </para></description><typedef name="value_type"><type>Char</type></typedef>
  541. <typedef name="pointer"><type>const value_type *</type></typedef>
  542. <typedef name="string_type"><type>std::basic_string&lt; value_type &gt;</type></typedef>
  543. <typedef name="range"><type>boost::iterator_range&lt; pointer &gt;</type></typedef>
  544. <typedef name="environment_t"><type>Environment</type></typedef>
  545. <method-group name="public member functions">
  546. <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>
  547. <method name="entry" cv="= default"><type/><parameter name=""><paramtype>const entry &amp;</paramtype></parameter><purpose>Copy Constructor. </purpose></method>
  548. <method name="empty" cv="const"><type>bool</type><purpose>Check if the entry is empty. </purpose></method>
  549. <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>
  550. <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 separated by ';' or ':'. </purpose></method>
  551. <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 separated by ';' or ':'. </purpose></method>
  552. <method name="clear"><type>void</type><purpose>Reset the value. </purpose></method>
  553. <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 separated by ';' or ':'. </purpose></method>
  554. </method-group>
  555. <copy-assignment cv="= default"><type>entry &amp;</type><parameter name=""><paramtype>const entry &amp;</paramtype></parameter><purpose>Move Constructor. </purpose></copy-assignment>
  556. <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>
  557. <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 separated by ';' or ':'. </purpose></copy-assignment>
  558. </struct><typedef name="string_type"><type>std::basic_string&lt; Char &gt;</type></typedef>
  559. <typedef name="iterator"><type>boost::transform_iterator&lt; entry_maker, Char ** &gt;</type></typedef>
  560. <typedef name="const_iterator"><type>boost::transform_iterator&lt; const_entry_maker, Char ** &gt;</type></typedef>
  561. <typedef name="size_type"><type>std::size_t</type></typedef>
  562. <typedef name="native_handle"><type><emphasis>unspecified</emphasis></type></typedef>
  563. <typedef name="base_type"><type><emphasis>unspecified</emphasis></type></typedef>
  564. <method-group name="public member functions">
  565. <method name="begin"><type>iterator</type><purpose>Returns an iterator to the beginning. </purpose></method>
  566. <method name="begin" cv="const"><type>const_iterator</type><purpose>Returns an iterator to the beginning. </purpose></method>
  567. <method name="cbegin" cv="const"><type>const_iterator</type><purpose>Returns an iterator to the beginning. </purpose></method>
  568. <method name="end"><type>iterator</type><purpose>Returns an iterator to the end. </purpose></method>
  569. <method name="end" cv="const"><type>const_iterator</type><purpose>Returns an iterator to the end. </purpose></method>
  570. <method name="cend" cv="const"><type>const_iterator</type><purpose>Returns an iterator to the end. </purpose></method>
  571. <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>
  572. <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>
  573. <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>
  574. <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>
  575. <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>
  576. <method name="empty"><type>bool</type><purpose>Check if environment has entries. </purpose></method>
  577. <method name="size" cv="const"><type>std::size_t</type><purpose>Get the number of variables. </purpose></method>
  578. <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>
  579. <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>
  580. <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>
  581. </method-group>
  582. <constructor><purpose>Default constructor. </purpose></constructor>
  583. <constructor><parameter name=""><paramtype><classname>basic_native_environment</classname> &amp;&amp;</paramtype></parameter><purpose>Move constructor. </purpose></constructor>
  584. <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>
  585. </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>
  586. <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>
  587. <typedef name="environment"><purpose>Type definition to hold a seperate environment. </purpose><type><classname>basic_environment</classname>&lt; char &gt;</type></typedef>
  588. <typedef name="wenvironment"><purpose>Type definition to hold a seperate environment. </purpose><type><classname>basic_environment</classname>&lt; wchar_t &gt;</type></typedef>
  589. </namespace>
  590. <namespace name="this_process">
  591. <function name="get_id"><type>int</type><purpose>Get the process id of the current process. </purpose></function>
  592. <function name="native_handle"><type>native_handle_type</type><purpose>Get the native handle of the current process. </purpose></function>
  593. <function name="environment"><type>native_environment</type><purpose>Get the enviroment of the current process. </purpose></function>
  594. <function name="wenvironment"><type>wnative_environment</type><purpose>Get the enviroment of the current process. </purpose></function>
  595. <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>
  596. </namespace>
  597. </namespace>
  598. </header>
  599. <header name="boost/process/error.hpp">
  600. <para>Header which provides the error properties. It allows to explicitly set the error handling, the properties are:</para><para>
  601. <programlisting language="c++">
  602. namespace boost {
  603. namespace process {
  604. <emphasis>unspecified</emphasis> <globalname alt="boost::process::ignore_error">ignore_error</globalname>;
  605. <emphasis>unspecified</emphasis> <globalname alt="boost::process::throw_on_error">throw_on_error</globalname>;
  606. <emphasis>unspecified</emphasis> <globalname alt="boost::process::error">error</globalname>;
  607. <emphasis>unspecified</emphasis> <globalname alt="boost::process::error_ref">error_ref</globalname>;
  608. <emphasis>unspecified</emphasis> <globalname alt="boost::process::error_code">error_code</globalname>;
  609. }
  610. }
  611. </programlisting>
  612. For error there are two aliases: error_ref and error_code </para><namespace name="boost">
  613. <namespace name="process">
  614. <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>
  615. <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>
  616. <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;
  617. system("gcc", error(ec));
  618. </programlisting></para><para>The following syntax is valid:</para><para><programlisting language="c++">error(ec);
  619. error=ec;
  620. </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>
  621. <data-member name="error_ref"><type><emphasis>unspecified</emphasis></type><purpose>Alias for <globalname alt="boost::process::error">error</globalname> . </purpose></data-member>
  622. <data-member name="error_code"><type><emphasis>unspecified</emphasis></type><purpose>Alias for <globalname alt="boost::process::error">error</globalname> . </purpose></data-member>
  623. </namespace>
  624. </namespace>
  625. </header>
  626. <header name="boost/process/exception.hpp">
  627. <namespace name="boost">
  628. <namespace name="process">
  629. <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>
  630. </namespace>
  631. </namespace>
  632. </header>
  633. <header name="boost/process/exe.hpp">
  634. <para>Header which provides the exe property.
  635. <programlisting language="c++">
  636. namespace boost {
  637. namespace process {
  638. <emphasis>unspecified</emphasis> <globalname alt="boost::process::exe">exe</globalname>;
  639. }
  640. }
  641. </programlisting>
  642. </para><namespace name="boost">
  643. <namespace name="filesystem">
  644. </namespace>
  645. <namespace name="process">
  646. <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";
  647. exe(value);
  648. </programlisting></para><para>The property can only be used for assignments. </para></description></data-member>
  649. </namespace>
  650. </namespace>
  651. </header>
  652. <header name="boost/process/extend.hpp">
  653. <para>This header which provides the types and functions provided for custom extensions.</para><para>
  654. Please refer to the <link linkend="boost_process.extend">tutorial</link> for more details.
  655. </para><namespace name="boost">
  656. <namespace name="process">
  657. <namespace name="extend">
  658. <struct name="async_handler"><inherit access="public">boost::process::extend::handler</inherit><inherit access="public">boost::process::extend::require_io_context</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_context">require_io_context</classname>.</para><para>You must add the following function to your implementation:</para><para><programlisting language="c++">template&lt;typename Executor&gt;
  659. std::function&lt;void(int, const std::error_code&amp;)&gt; on_exit_handler(Executor &amp; exec)
  660. {
  661. auto handler_ = this-&gt;handler;
  662. return [handler_](int exit_code, const std::error_code &amp; ec)
  663. {
  664. handler_(static_cast&lt;int&gt;(exit_code), ec);
  665. };
  666. }
  667. </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>
  668. </warning>
  669. </para></description></struct><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>
  670. </note>
  671. </para></description><method-group name="public member functions">
  672. <method name="on_setup" cv="const"><type>void</type><template>
  673. <template-type-parameter name="Executor"/>
  674. </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>
  675. </note>
  676. </para></description></method>
  677. <method name="on_error" cv="const"><type>void</type><template>
  678. <template-type-parameter name="Executor"/>
  679. </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>
  680. </note>
  681. </para></description></method>
  682. <method name="on_success" cv="const"><type>void</type><template>
  683. <template-type-parameter name="Executor"/>
  684. </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>
  685. </note>
  686. </para></description></method>
  687. <method name="on_fork_error" cv="const"><type>void</type><template>
  688. <template-type-parameter name="Executor"/>
  689. </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>
  690. </note>
  691. </para></description></method>
  692. <method name="on_exec_setup" cv="const"><type>void</type><template>
  693. <template-type-parameter name="Executor"/>
  694. </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>
  695. </note>
  696. <note><para>It will be invoked from the new process. </para>
  697. </note>
  698. </para></description></method>
  699. <method name="on_exec_error" cv="const"><type>void</type><template>
  700. <template-type-parameter name="Executor"/>
  701. </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>
  702. </note>
  703. <note><para>It will be invoked from the new process. </para>
  704. </note>
  705. </para></description></method>
  706. </method-group>
  707. </struct><struct name="posix_executor"><template>
  708. <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>
  709. </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>
  710. </note>
  711. As information for extension development, here is the structure of the process launching (in pseudo-code and uml)
  712. <programlisting language="c++">
  713. for (auto &amp; s : seq)
  714. s.<methodname alt="boost::process::extend::handler::on_setup">on_setup</methodname>(*this);
  715. if (<methodname alt="boost::process::extend::posix_executor::error">error</methodname>())
  716. {
  717. for (auto &amp; s : seq)
  718. s.<methodname alt="boost::process::extend::handler::on_error">on_error</methodname>(*this, <methodname alt="boost::process::extend::posix_executor::error">error</methodname>());
  719. return <classname alt="boost::process::child">child</classname>();
  720. }
  721. pid = <ulink url="http://pubs.opengroup.org/onlinepubs/009695399/functions/fork.html">fork()</ulink>
  722. <methodname alt="boost::process::extend::handler::on_setup">on_setup</methodname>(*this);
  723. if (pid == -1) //fork error
  724. {
  725. <methodname alt="boost::process::extend::posix_executor::set_error">set_error</methodname>(<functionname alt="boost::process::extend::get_last_error">get_last_error</functionname>());
  726. for (auto &amp; s : seq)
  727. 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>());
  728. for (auto &amp; s : seq)
  729. s.<methodname alt="boost::process::extend::handler::on_error">on_error</methodname>(*this, <methodname alt="boost::process::extend::posix_executor::error">error</methodname>());
  730. return <classname alt="boost::process::child">child</classname>()
  731. }
  732. else if (pid == 0) //child process
  733. {
  734. for (auto &amp; s : seq)
  735. s.<methodname alt="boost::process::extend::handler::on_exec_setup">on_exec_setup</methodname>(*this);
  736. <ulink url="http://pubs.opengroup.org/onlinepubs/009695399/functions/exec.html">execve</ulink>(exe, cmd_line, env);
  737. auto ec = <functionname alt="boost::process::extend::get_last_error">get_last_error</functionname>();
  738. for (auto &amp; s : seq)
  739. s.<methodname alt="boost::process::extend::handler::on_exec_error">on_exec_error</methodname>(*this);
  740. <emphasis>unspecified();</emphasis>//here the error is send to the father process interally
  741. <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>);
  742. return <classname alt="boost::process::child">child</classname>(); //for C++ compliance
  743. }
  744. <classname alt="boost::process::child">child</classname> c(pid, exit_code);
  745. <emphasis>unspecified();</emphasis>//here, we read the the error from the child process
  746. if (<methodname alt="boost::process::extend::posix_executor::error">error</methodname>())
  747. for (auto &amp; s : seq)
  748. s.<methodname alt="boost::process::extend::handler::on_error">on_error</methodname>(*this, <methodname alt="boost::process::extend::posix_executor::error">error</methodname>());
  749. else
  750. for (auto &amp; s : seq)
  751. s.<methodname alt="boost::process::extend::handler::on_error">on_success</methodname>(*this);
  752. //now we check again, because a on_success handler might've errored.
  753. if (<methodname alt="boost::process::extend::posix_executor::error">error</methodname>())
  754. {
  755. for (auto &amp; s : seq)
  756. s.<methodname alt="boost::process::extend::handler::on_error">on_error</methodname>(*this, <methodname alt="boost::process::extend::posix_executor::error">error</methodname>());
  757. return <classname alt="boost::process::child">child</classname>();
  758. }
  759. else
  760. return c;
  761. </programlisting>
  762. <mediaobject>
  763. <caption>
  764. <para>The sequence if when no error occurs.</para>
  765. </caption>
  766. <imageobject>
  767. <imagedata fileref="boost_process/posix_success.svg"/>
  768. </imageobject>
  769. </mediaobject>
  770. <mediaobject>
  771. <caption>
  772. <para>The sequence if the execution fails.</para>
  773. </caption>
  774. <imageobject>
  775. <imagedata fileref="boost_process/posix_exec_err.svg"/>
  776. </imageobject>
  777. </mediaobject>
  778. <mediaobject>
  779. <caption>
  780. <para>The sequence if the fork fails.</para>
  781. </caption>
  782. <imageobject>
  783. <imagedata fileref="boost_process/posix_fork_err.svg"/>
  784. </imageobject>
  785. </mediaobject>
  786. </para><para><note><para>Error handling if execve fails is done through a pipe, unless ignore_error is used. </para>
  787. </note>
  788. </para></description><data-member name="seq"><type>Sequence &amp;</type><purpose>A reference to the actual initializer-sequence. </purpose></data-member>
  789. <data-member name="exe"><type>const char *</type><purpose>A pointer to the name of the executable. </purpose></data-member>
  790. <data-member name="cmd_line"><type>char *const *</type><purpose>A pointer to the argument-vector. </purpose></data-member>
  791. <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>
  792. <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>
  793. <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_context</computeroutput> and <classname alt="boost::process::child">child</classname>. </purpose></data-member>
  794. <method-group name="public member functions">
  795. <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>
  796. <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>
  797. </note>
  798. </para></description></method>
  799. <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>
  800. </method-group>
  801. </struct><struct name="require_io_context"><description><para>Inheriting the class will tell the launching process that an <computeroutput>io_context</computeroutput> is needed. This should always be used when get_io_context is used. </para></description></struct><struct name="windows_executor"><template>
  802. <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>
  803. <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>
  804. </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>
  805. </note>
  806. As information for extension development, here is the structure of the process launching (in pseudo-code and uml)<programlisting language="c++">
  807. for (auto &amp; s : seq)
  808. s.<methodname alt="boost::process::extend::handler::on_setup">on_setup</methodname>(*this);
  809. if (<methodname alt="boost::process::extend::windows_executor::error">error</methodname>())
  810. {
  811. for (auto &amp; s : seq)
  812. s.<methodname alt="boost::process::extend::handler::on_error">on_error</methodname>(*this, <methodname alt="boost::process::extend::windows_executor::error">error</methodname>());
  813. return <classname alt="boost::process::child">child</classname>();
  814. }
  815. int err_code = <ulink url="https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425.aspx">CreateProcess</ulink>(
  816. exe,
  817. cmd_line,
  818. proc_attrs,
  819. thread_attrs,
  820. creation_flags,
  821. env,
  822. work_dir,
  823. startup_info,
  824. proc_info);
  825. <classname alt="boost::process::child">child</classname> c(proc_info, exit_code);
  826. if (<methodname alt="boost::process::extend::windows_executor::error">error</methodname>())
  827. for (auto &amp; s : seq)
  828. s.<methodname alt="boost::process::extend::handler::on_error">on_error</methodname>(*this, <methodname alt="boost::process::extend::windows_executor::error">error</methodname>());
  829. else
  830. for (auto &amp; s : seq)
  831. s.<methodname alt="boost::process::extend::handler::on_error">on_success</methodname>(*this);
  832. //now we check again, because a on_success handler might've errored.
  833. if (<methodname alt="boost::process::extend::windows_executor::error">error</methodname>())
  834. {
  835. for (auto &amp; s : seq)
  836. s.<methodname alt="boost::process::extend::handler::on_error">on_error</methodname>(*this, <methodname alt="boost::process::extend::windows_executor::error">error</methodname>());
  837. return <classname alt="boost::process::child">child</classname>();
  838. }
  839. else
  840. return c;
  841. </programlisting>
  842. <mediaobject>
  843. <caption>
  844. <para>The sequence for windows process creation.</para>
  845. </caption>
  846. <imageobject>
  847. <imagedata fileref="boost_process/windows_exec.svg"/>
  848. </imageobject>
  849. </mediaobject>
  850. </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>
  851. <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>
  852. <data-member name="seq"><type>Sequence &amp;</type><purpose>A reference to the actual initializer-sequence. </purpose></data-member>
  853. <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>
  854. <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>
  855. <data-member name="env"><type>char Char *</type><purpose>A pointer to the environment variables. It's null by default. </purpose></data-member>
  856. <data-member name="work_dir"><type>const Char *</type><purpose>A pointer to the working directory. It's null by default. </purpose></data-member>
  857. <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>
  858. <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>
  859. <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>
  860. <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>
  861. <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_context</computeroutput> and <classname alt="boost::process::child">child</classname>. </purpose></data-member>
  862. <data-member name="creation_flags"><type><emphasis>unspecified</emphasis></type><purpose>The creation flags of the process. </purpose></data-member>
  863. <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>
  864. <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>
  865. <method-group name="public member functions">
  866. <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>
  867. <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>
  868. </note>
  869. </para></description></method>
  870. <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>
  871. <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>
  872. </note>
  873. </para></description></method>
  874. </method-group>
  875. </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>
  876. <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>
  877. <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>
  878. <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>
  879. </note>
  880. </para></description></data-member>
  881. <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>
  882. </note>
  883. </para></description></data-member>
  884. <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>
  885. </note>
  886. </para></description></data-member>
  887. <function name="get_last_error"><type>std::error_code</type><purpose>Helper function to get the last error code system-independent. </purpose></function>
  888. <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.
  889. </para></description><throws><simpara><classname>boost::process::process_error</classname> </simpara></throws></overloaded-function>
  890. <function name="get_io_context"><type>asio::io_context &amp;</type><template>
  891. <template-type-parameter name="Sequence"/>
  892. </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_context from the initializer sequence.</para><para><note><para>Yields a compile-time error if no <computeroutput>io_context</computeroutput> is provided. </para>
  893. </note>
  894. </para></description></function>
  895. </namespace>
  896. </namespace>
  897. </namespace>
  898. </header>
  899. <header name="boost/process/group.hpp">
  900. <para>Defines a group process class. For additional information see the platform specific implementations:</para><para><itemizedlist>
  901. <listitem><para><ulink url="https://msdn.microsoft.com/en-us/library/windows/desktop/ms684161.aspx">windows - job object</ulink></para>
  902. </listitem><listitem><para><ulink url="http://pubs.opengroup.org/onlinepubs/009695399/functions/setpgid.html">posix - process group</ulink> </para>
  903. </listitem></itemizedlist>
  904. </para><namespace name="boost">
  905. <namespace name="process">
  906. <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>
  907. </note>
  908. <note><para>If a default-constructed group is used before being used in a process launch, the behaviour is undefined.</para>
  909. </note>
  910. <note><para>Waiting for groups is currently broken on windows and will most likely result in a dead-lock. </para>
  911. </note>
  912. </para></description><typedef name="group_handle"><type><emphasis>unspecified</emphasis></type></typedef>
  913. <typedef name="native_handle_t"><purpose>Native representation of the handle. </purpose><type>group_handle::handle_t</type></typedef>
  914. <method-group name="public member functions">
  915. <method name="detach"><type>void</type><purpose>Detach the group. </purpose></method>
  916. <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>
  917. <method name="joinable"><type>bool</type><description><para>Check if the child is joinable. </para></description></method>
  918. <method name="native_handle" cv="const"><type>native_handle_t</type><purpose>Obtain the native handle of the group. </purpose></method>
  919. <method name="wait"><type>void</type><purpose>Wait for the process group to exit. </purpose></method>
  920. <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>
  921. <method name="wait_for"><type>bool</type><template>
  922. <template-type-parameter name="Rep"/>
  923. <template-type-parameter name="Period"/>
  924. </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.
  925. </para></description><returns><para>True if all child processes exited while waiting. </para>
  926. </returns></method>
  927. <method name="wait_for" cv="noexcept"><type>bool</type><template>
  928. <template-type-parameter name="Rep"/>
  929. <template-type-parameter name="Period"/>
  930. </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>
  931. <method name="wait_until"><type>bool</type><template>
  932. <template-type-parameter name="Clock"/>
  933. <template-type-parameter name="Duration"/>
  934. </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.
  935. </para></description><returns><para>True if all child processes exited while waiting. </para>
  936. </returns></method>
  937. <method name="wait_until" cv="noexcept"><type>bool</type><template>
  938. <template-type-parameter name="Clock"/>
  939. <template-type-parameter name="Duration"/>
  940. </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>
  941. <method name="valid" cv="const"><type>bool</type><purpose>Check if the group has a valid handle. </purpose></method>
  942. <method name="conversion-operator" cv="const" specifiers="explicit"><type>bool</type><purpose>Convenience to call valid. </purpose></method>
  943. <method name="terminate"><type>void</type><purpose>Terminate the process group, i.e. all processes in the group. </purpose></method>
  944. <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>
  945. <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>
  946. <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>
  947. <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>
  948. <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>
  949. </method-group>
  950. <constructor specifiers="explicit"><parameter name="ch"><paramtype>group_handle &amp;&amp;</paramtype></parameter></constructor>
  951. <constructor specifiers="explicit"><parameter name="handle"><paramtype>native_handle_t &amp;</paramtype></parameter><purpose>Construct the group from a native_handle. </purpose></constructor>
  952. <constructor cv="= delete"><parameter name=""><paramtype>const <classname>group</classname> &amp;</paramtype></parameter></constructor>
  953. <constructor><parameter name="lhs"><paramtype><classname>group</classname> &amp;&amp;</paramtype></parameter><purpose>Move constructor. </purpose></constructor>
  954. <constructor cv="= default"><purpose>Default constructor. </purpose></constructor>
  955. <copy-assignment cv="= delete"><type><classname>group</classname> &amp;</type><parameter name=""><paramtype>const <classname>group</classname> &amp;</paramtype></parameter></copy-assignment>
  956. <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>
  957. <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>
  958. </note>
  959. </para></description></destructor>
  960. </class>
  961. </namespace>
  962. </namespace>
  963. </header>
  964. <header name="boost/process/handles.hpp">
  965. <para>Defines functions to obtain handles of the current process and limit the amount for inherited ones. </para><namespace name="boost">
  966. <namespace name="process">
  967. <data-member name="limit_handles" specifiers="static"><type><emphasis>unspecified</emphasis></type><description><para>The limit_handles property sets all properties to be inherited only expcitly. It closes all unused file-descriptors on posix after the fork and removes the inherit flags on windows.</para><para><note><para>This is executed after the fork on posix.</para>
  968. </note>
  969. <programlisting language="c++">system("gcc", limit_handles);
  970. </programlisting></para><para>Since limit also closes the standard handles unless they are explicitly redirected they can be ignored by <computeroutput>limit_handles</computeroutput> in the following way.</para><para><programlisting language="c++">system("gcc", limit_handles.allowStd())
  971. </programlisting> </para></description></data-member>
  972. </namespace>
  973. <namespace name="this_process">
  974. <typedef name="native_handle_type"><purpose>The native type for handles. </purpose><description><para>Definition of the native handle type. </para></description><type><emphasis>unspecified</emphasis></type></typedef>
  975. <overloaded-function name="get_handles"><signature><type>std::vector&lt; native_handle_type &gt;</type></signature><signature><type>std::vector&lt; native_handle_type &gt;</type><parameter name="ec"><paramtype>std::error_code &amp;</paramtype></parameter></signature><description><para>Get a snapshot of all handles of the process (i.e. file descriptors on posix and handles on windows) of the current process.</para><para><note><para>This function might not work on certain posix systems.</para>
  976. </note>
  977. <note><para>On Windows version older than windows 8 this function will iterate all the system handles, meaning it might be quite slow.</para>
  978. </note>
  979. <warning><para>This functionality is utterly prone to race conditions, since other threads might open or close handles.</para>
  980. </warning>
  981. </para></description><returns><para>The list of all open handles of the current process </para>
  982. </returns></overloaded-function>
  983. <overloaded-function name="is_stream_handle"><signature><type>bool</type><parameter name="handle"><paramtype>native_handle_type</paramtype></parameter></signature><signature><type>bool</type><parameter name="handle"><paramtype>native_handle_type</paramtype></parameter><parameter name="ec"><paramtype>std::error_code &amp;</paramtype></parameter></signature><description><para>Determines if a given handle is a a stream-handle, i.e. any handle that can be used with read and write functions. Stream handles include pipes, regular files and sockets.</para><para>
  984. </para></description><returns><para>Indicates if it's a stream handle. </para>
  985. </returns></overloaded-function>
  986. </namespace>
  987. </namespace>
  988. </header>
  989. <header name="boost/process/io.hpp">
  990. <para>Header which provides the io properties. It provides the following properties:</para><para>
  991. <programlisting language="c++">
  992. namespace boost {
  993. namespace process {
  994. <emphasis>unspecified</emphasis> <globalname alt="boost::process::close">close</globalname>;
  995. <emphasis>unspecified</emphasis> <globalname alt="boost::process::null">null</globalname>;
  996. <emphasis>unspecified</emphasis> <globalname alt="boost::process::std_in">std_in</globalname>;
  997. <emphasis>unspecified</emphasis> <globalname alt="boost::process::std_out">std_out</globalname>;
  998. <emphasis>unspecified</emphasis> <globalname alt="boost::process::std_err">std_err</globalname>;
  999. }
  1000. }
  1001. </programlisting>
  1002. </para><para><formalpara><title>File I/O</title><para/>
  1003. </formalpara>
  1004. 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";
  1005. boost::filesystem::path input = "input.txt";
  1006. boost::filesystem::path output = "output.txt";
  1007. system("my_prog", std_out&gt;output, std_in&lt;input, std_err&gt;log);
  1008. </programlisting></para><para><formalpara><title>Synchronous Pipe I/O</title><para/>
  1009. </formalpara>
  1010. Another way is to communicate through pipes.</para><para><programlisting language="c++">pstream str;
  1011. child c("my_prog", std_out &gt; str);
  1012. int i;
  1013. str &gt;&gt; i;
  1014. </programlisting></para><para>Note that the pipe may also be used between several processes, like this:</para><para><programlisting language="c++">pipe p;
  1015. child c1("nm", "a.out", std_out&gt;p);
  1016. child c2("c++filt", std_in&lt;p);
  1017. </programlisting></para><para><formalpara><title>Asynchronous I/O</title><para/>
  1018. </formalpara>
  1019. Utilizing <computeroutput>boost.asio</computeroutput> asynchronous I/O is provided.</para><para><programlisting language="c++">boost::asio::io_context ios;
  1020. std::future&lt;std::string&gt; output;
  1021. system("ls", std_out &gt; output, ios);
  1022. auto res = fut.get();
  1023. </programlisting></para><para><note><para><computeroutput>boost/process/async.hpp</computeroutput> must also be included for this to work.</para>
  1024. </note>
  1025. <formalpara><title>Closing</title><para/>
  1026. </formalpara>
  1027. Stream can be closed, so nothing can be read or written.</para><para><programlisting language="c++">system("foo", std_in.close());
  1028. </programlisting></para><para><formalpara><title>Null</title><para/>
  1029. </formalpara>
  1030. 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);
  1031. </programlisting> </para><namespace name="boost">
  1032. <namespace name="process">
  1033. <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>
  1034. <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>
  1035. <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">
  1036. <title>Details</title>
  1037. <sect2 id="namespaceboost_1_1process_1stdin_file">
  1038. <title>File Input</title>
  1039. <para>The file I/O simple redirects the stream to a file, for which the possible types are</para>
  1040. <para><itemizedlist>
  1041. <listitem><para><computeroutput>boost::filesystem::path</computeroutput></para>
  1042. </listitem><listitem><para><computeroutput>std::basic_string&lt;char_type&gt;</computeroutput></para>
  1043. </listitem><listitem><para><computeroutput>const char_type*</computeroutput></para>
  1044. </listitem><listitem><para><computeroutput>FILE*</computeroutput></para>
  1045. </listitem></itemizedlist>
  1046. </para>
  1047. <para>with <computeroutput>char_type</computeroutput> being either <computeroutput>char</computeroutput> or <computeroutput>wchar_t</computeroutput>.</para>
  1048. <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>
  1049. <para><programlisting language="c++">system("ls", std_in &lt; stdin);
  1050. </programlisting></para>
  1051. <para><warning><para>If the launching and the child process use the input, this leads to undefined behaviour.</para>
  1052. </warning>
  1053. 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>
  1054. <para>The valid expressions for this property are</para>
  1055. <para><programlisting language="c++">std_in &lt; file;
  1056. std_in = file;
  1057. </programlisting></para>
  1058. </sect2>
  1059. <sect2 id="namespaceboost_1_1process_1stdin_pipe">
  1060. <title>Pipe Input</title>
  1061. <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>
  1062. <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>
  1063. </note>
  1064. Valid expressions with pipes are these:</para>
  1065. <para><programlisting language="c++">std_in &lt; pipe;
  1066. std_in = pipe;
  1067. </programlisting></para>
  1068. <para>Where the valid types for <computeroutput>pipe</computeroutput> are the following:</para>
  1069. <para><itemizedlist>
  1070. <listitem><para><computeroutput><classname alt="boost::process::basic_pipe">basic_pipe</classname></computeroutput></para>
  1071. </listitem><listitem><para><computeroutput><classname alt="boost::process::async_pipe">async_pipe</classname></computeroutput></para>
  1072. </listitem><listitem><para><computeroutput><classname alt="boost::process::basic_opstream">basic_opstream</classname></computeroutput></para>
  1073. </listitem><listitem><para><computeroutput><classname alt="boost::process::basic_pstream">basic_pstream</classname></computeroutput></para>
  1074. </listitem></itemizedlist>
  1075. </para>
  1076. <para>Note that the pipe may also be used between several processes, like this:</para>
  1077. <para><programlisting language="c++">pipe p;
  1078. child c1("nm", "a.out", std_out&gt;p);
  1079. child c2("c++filt", std_in&lt;p);
  1080. </programlisting></para>
  1081. </sect2>
  1082. <sect2 id="namespaceboost_1_1process_1stdin_async_pipe">
  1083. <title>Asynchronous Pipe Input</title>
  1084. <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>
  1085. <para>Valid types for pipe I/O are the following:</para>
  1086. <para><itemizedlist>
  1087. <listitem><para><computeroutput>boost::asio::const_buffer</computeroutput> <footnote><para> Constructed with <code>boost::asio::buffer</code></para></footnote> </para>
  1088. </listitem><listitem><para><computeroutput>boost::asio::mutable_buffer</computeroutput> <footnote><para> Constructed with <code>boost::asio::buffer</code></para></footnote> </para>
  1089. </listitem><listitem><para><computeroutput>boost::asio::streambuf</computeroutput></para>
  1090. </listitem></itemizedlist>
  1091. </para>
  1092. <para>Valid expressions with pipes are these:</para>
  1093. <para><programlisting language="c++">std_in &lt; buffer;
  1094. std_in = buffer;
  1095. std_out &gt; buffer;
  1096. std_out = buffer;
  1097. std_err &gt; buffer;
  1098. std_err = buffer;
  1099. (std_out &amp; std_err) &gt; buffer;
  1100. (std_out &amp; std_err) = buffer;
  1101. </programlisting></para>
  1102. <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;
  1103. boost::asio::io_context ios;
  1104. std::string data;
  1105. child c("prog", std_in &lt; buffer(data) &gt; fut, ios);
  1106. fut.get();
  1107. </programlisting></para>
  1108. </note>
  1109. <note><para><computeroutput>boost::asio::buffer</computeroutput> is also available in the <computeroutput>boost::process</computeroutput> namespace.</para>
  1110. </note>
  1111. <warning><para>This feature requires <computeroutput>boost/process/async.hpp</computeroutput> to be included and a reference to <computeroutput>boost::asio::io_context</computeroutput> to be passed to the launching function.</para>
  1112. </warning>
  1113. </para>
  1114. </sect2>
  1115. <sect2 id="namespaceboost_1_1process_1stdin_close">
  1116. <title>Close</title>
  1117. <para>The input stream can be closed, so it cannot be read from. This will lead to an error when attempted.</para>
  1118. <para>This can be achieved by the following syntax.</para>
  1119. <para><programlisting language="c++">std_in &lt; close;
  1120. std_in = close;
  1121. std_in.close();
  1122. </programlisting></para>
  1123. </sect2>
  1124. <sect2 id="namespaceboost_1_1process_1stdin_null">
  1125. <title>Null</title>
  1126. <para>The input stream can be redirected to read from the null-device, which means that only <computeroutput>EOF</computeroutput> is read.</para>
  1127. <para>The syntax to achieve that has the following variants:</para>
  1128. <para><programlisting language="c++">std_in &lt; null;
  1129. std_in = null;
  1130. std_in.null();
  1131. </programlisting> </para>
  1132. </sect2>
  1133. </sect1></description></data-member>
  1134. <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>
  1135. </note>
  1136. <note><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>
  1137. </note>
  1138. </para><sect1 id="namespaceboost_1_1process_1stdout_details">
  1139. <title>Details</title>
  1140. <sect2 id="namespaceboost_1_1process_1stdout_file">
  1141. <title>File Input</title>
  1142. <para>The file I/O simple redirects the stream to a file, for which the possible types are</para>
  1143. <para><itemizedlist>
  1144. <listitem><para><computeroutput>boost::filesystem::path</computeroutput></para>
  1145. </listitem><listitem><para><computeroutput>std::basic_string&lt;char_type&gt;</computeroutput></para>
  1146. </listitem><listitem><para><computeroutput>const char_type*</computeroutput></para>
  1147. </listitem><listitem><para><computeroutput>FILE*</computeroutput></para>
  1148. </listitem></itemizedlist>
  1149. </para>
  1150. <para>with <computeroutput>char_type</computeroutput> being either <computeroutput>char</computeroutput> or <computeroutput>wchar_t</computeroutput>.</para>
  1151. <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>
  1152. <para><programlisting language="c++">system("ls", std_out &lt; stdin);
  1153. </programlisting></para>
  1154. <para><warning><para>If the launching and the child process use the input, this leads to undefined behaviour.</para>
  1155. </warning>
  1156. 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>
  1157. <para>The valid expressions for this property are</para>
  1158. <para><programlisting language="c++">std_out &lt; file;
  1159. std_out = file;
  1160. </programlisting></para>
  1161. </sect2>
  1162. <sect2 id="namespaceboost_1_1process_1stdout_pipe">
  1163. <title>Pipe Output</title>
  1164. <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>
  1165. <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>
  1166. </note>
  1167. Valid expressions with pipes are these:</para>
  1168. <para><programlisting language="c++">std_out &gt; pipe;
  1169. std_out = pipe;
  1170. </programlisting></para>
  1171. <para>Where the valid types for <computeroutput>pipe</computeroutput> are the following:</para>
  1172. <para><itemizedlist>
  1173. <listitem><para><computeroutput><classname alt="boost::process::basic_pipe">basic_pipe</classname></computeroutput></para>
  1174. </listitem><listitem><para><computeroutput><classname alt="boost::process::async_pipe">async_pipe</classname></computeroutput></para>
  1175. </listitem><listitem><para><computeroutput><classname alt="boost::process::basic_ipstream">basic_ipstream</classname></computeroutput></para>
  1176. </listitem><listitem><para><computeroutput><classname alt="boost::process::basic_pstream">basic_pstream</classname></computeroutput></para>
  1177. </listitem></itemizedlist>
  1178. </para>
  1179. <para>Note that the pipe may also be used between several processes, like this:</para>
  1180. <para><programlisting language="c++">pipe p;
  1181. child c1("nm", "a.out", std_out&gt;p);
  1182. child c2("c++filt", std_in&lt;p);
  1183. </programlisting></para>
  1184. </sect2>
  1185. <sect2 id="namespaceboost_1_1process_1stdout_async_pipe">
  1186. <title>Asynchronous Pipe Output</title>
  1187. <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>
  1188. <para>Valid types for pipe I/O are the following:</para>
  1189. <para><itemizedlist>
  1190. <listitem><para><computeroutput>boost::asio::mutable_buffer</computeroutput> <footnote><para> Constructed with <code>boost::asio::buffer</code></para></footnote> </para>
  1191. </listitem><listitem><para><computeroutput>boost::asio::streambuf</computeroutput></para>
  1192. </listitem><listitem><para><computeroutput>std::future&lt;std::vector&lt;char&gt;&gt;</computeroutput></para>
  1193. </listitem><listitem><para><computeroutput>std::future&lt;std::string&gt;</computeroutput></para>
  1194. </listitem></itemizedlist>
  1195. </para>
  1196. <para>Valid expressions with pipes are these:</para>
  1197. <para><programlisting language="c++">std_out &gt; buffer;
  1198. std_out = buffer;
  1199. std_err &gt; buffer;
  1200. std_err = buffer;
  1201. (std_out &amp; std_err) &gt; buffer;
  1202. (std_out &amp; std_err) = buffer;
  1203. </programlisting></para>
  1204. <para><note><para><computeroutput>boost::asio::buffer</computeroutput> is also available in the <computeroutput>boost::process</computeroutput> namespace.</para>
  1205. </note>
  1206. <warning><para>This feature requires <computeroutput>boost/process/async.hpp</computeroutput> to be included and a reference to <computeroutput>boost::asio::io_context</computeroutput> to be passed to the launching function.</para>
  1207. </warning>
  1208. </para>
  1209. </sect2>
  1210. <sect2 id="namespaceboost_1_1process_1stdout_close">
  1211. <title>Close</title>
  1212. <para>The out stream can be closed, so it cannot be write from. This will lead to an error when attempted.</para>
  1213. <para>This can be achieved by the following syntax.</para>
  1214. <para><programlisting language="c++">std_out &gt; close;
  1215. std_out = close;
  1216. std_out.close();
  1217. </programlisting></para>
  1218. </sect2>
  1219. <sect2 id="namespaceboost_1_1process_1stdout_null">
  1220. <title>Null</title>
  1221. <para>The output stream can be redirected to write to the null-device, which means that all output is discarded.</para>
  1222. <para>The syntax to achieve that has the following variants:</para>
  1223. <para><programlisting language="c++">std_out &gt; null;
  1224. std_out = null;
  1225. std_out.null();
  1226. </programlisting> </para>
  1227. </sect2>
  1228. </sect1></description></data-member>
  1229. <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>
  1230. </namespace>
  1231. </namespace>
  1232. </header>
  1233. <header name="boost/process/locale.hpp">
  1234. <namespace name="boost">
  1235. <namespace name="process">
  1236. <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>
  1237. <function name="codecvt_category"><type>const std::error_category &amp;</type><purpose>Internally used error cateory for code conversion. </purpose></function>
  1238. <function name="codecvt"><type>const codecvt_type &amp;</type><purpose>Get a reference to the currently used code converter. </purpose></function>
  1239. <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>
  1240. </namespace>
  1241. </namespace>
  1242. </header>
  1243. <header name="boost/process/pipe.hpp">
  1244. <namespace name="boost">
  1245. <namespace name="process">
  1246. <class name="basic_ipstream"><template>
  1247. <template-type-parameter name="CharT"/>
  1248. <template-type-parameter name="Traits"><default>std::char_traits&lt;CharT&gt;</default></template-type-parameter>
  1249. </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>
  1250. <typedef name="char_type"><type>CharT</type></typedef>
  1251. <typedef name="traits_type"><type>Traits</type></typedef>
  1252. <typedef name="int_type"><type>Traits::int_type</type></typedef>
  1253. <typedef name="pos_type"><type>Traits::pos_type</type></typedef>
  1254. <typedef name="off_type"><type>Traits::off_type</type></typedef>
  1255. <method-group name="public member functions">
  1256. <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>
  1257. <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>
  1258. <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>
  1259. <method name="pipe"><type><classname>pipe_type</classname> &amp;</type><purpose>Get a reference to the pipe. </purpose></method>
  1260. <method name="pipe" cv="const"><type>const <classname>pipe_type</classname> &amp;</type><purpose>Get a const reference to the pipe. </purpose></method>
  1261. <method name="pipe"><type><classname>pipe_type</classname> &amp;&amp;</type><purpose>Get a rvalue reference to the pipe. Qualified as rvalue. </purpose></method>
  1262. <method name="is_open" cv="const"><type>bool</type><purpose>Check if the pipe is open. </purpose></method>
  1263. <method name="open"><type>void</type><purpose>Open a new pipe. </purpose></method>
  1264. <method name="open"><type>void</type><parameter name="name"><paramtype>const std::string &amp;</paramtype></parameter><purpose>Open a new named pipe. </purpose></method>
  1265. <method name="close"><type>void</type><purpose>Flush the buffer &amp; close the pipe. </purpose></method>
  1266. </method-group>
  1267. <constructor><purpose>Default constructor. </purpose></constructor>
  1268. <constructor cv="= delete"><parameter name=""><paramtype>const <classname>basic_ipstream</classname> &amp;</paramtype></parameter><purpose>Copy constructor. </purpose></constructor>
  1269. <constructor><parameter name="lhs"><paramtype><classname>basic_ipstream</classname> &amp;&amp;</paramtype></parameter><purpose>Move constructor. </purpose></constructor>
  1270. <constructor><parameter name="p"><paramtype><classname>pipe_type</classname> &amp;&amp;</paramtype></parameter><purpose>Move construct from a pipe. </purpose></constructor>
  1271. <constructor><parameter name="p"><paramtype>const <classname>pipe_type</classname> &amp;</paramtype></parameter><purpose>Copy construct from a pipe. </purpose></constructor>
  1272. <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>
  1273. <copy-assignment><type><classname>basic_ipstream</classname> &amp;</type><parameter name="lhs"><paramtype><classname>basic_ipstream</classname> &amp;&amp;</paramtype></parameter><purpose>Move assignment. </purpose></copy-assignment>
  1274. <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>
  1275. <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>
  1276. </class><class name="basic_opstream"><template>
  1277. <template-type-parameter name="CharT"/>
  1278. <template-type-parameter name="Traits"><default>std::char_traits&lt;CharT&gt;</default></template-type-parameter>
  1279. </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>
  1280. <typedef name="char_type"><type>CharT</type></typedef>
  1281. <typedef name="traits_type"><type>Traits</type></typedef>
  1282. <typedef name="int_type"><type>Traits::int_type</type></typedef>
  1283. <typedef name="pos_type"><type>Traits::pos_type</type></typedef>
  1284. <typedef name="off_type"><type>Traits::off_type</type></typedef>
  1285. <method-group name="public member functions">
  1286. <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>
  1287. <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>
  1288. <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>
  1289. <method name="pipe"><type><classname>pipe_type</classname> &amp;</type><purpose>Get a reference to the pipe. </purpose></method>
  1290. <method name="pipe" cv="const"><type>const <classname>pipe_type</classname> &amp;</type><purpose>Get a const reference to the pipe. </purpose></method>
  1291. <method name="pipe"><type><classname>pipe_type</classname> &amp;&amp;</type><purpose>Get a rvalue reference to the pipe. Qualified as rvalue. </purpose></method>
  1292. <method name="open"><type>void</type><purpose>Open a new pipe. </purpose></method>
  1293. <method name="open"><type>void</type><parameter name="name"><paramtype>const std::string &amp;</paramtype></parameter><purpose>Open a new named pipe. </purpose></method>
  1294. <method name="close"><type>void</type><purpose>Flush the buffer &amp; close the pipe. </purpose></method>
  1295. </method-group>
  1296. <constructor><purpose>Default constructor. </purpose></constructor>
  1297. <constructor cv="= delete"><parameter name=""><paramtype>const <classname>basic_opstream</classname> &amp;</paramtype></parameter><purpose>Copy constructor. </purpose></constructor>
  1298. <constructor><parameter name="lhs"><paramtype><classname>basic_opstream</classname> &amp;&amp;</paramtype></parameter><purpose>Move constructor. </purpose></constructor>
  1299. <constructor><parameter name="p"><paramtype><classname>pipe_type</classname> &amp;&amp;</paramtype></parameter><purpose>Move construct from a pipe. </purpose></constructor>
  1300. <constructor><parameter name="p"><paramtype>const <classname>pipe_type</classname> &amp;</paramtype></parameter><purpose>Copy construct from a pipe. </purpose></constructor>
  1301. <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>
  1302. <copy-assignment><type><classname>basic_opstream</classname> &amp;</type><parameter name="lhs"><paramtype><classname>basic_opstream</classname> &amp;&amp;</paramtype></parameter><purpose>Move assignment. </purpose></copy-assignment>
  1303. <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>
  1304. <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>
  1305. </class><class name="basic_pipe"><template>
  1306. <template-type-parameter name="CharT"/>
  1307. <template-type-parameter name="Traits"><default>std::char_traits&lt;CharT&gt;</default></template-type-parameter>
  1308. </template><description><para>Class implementation of a pipe. </para></description><typedef name="char_type"><type>CharT</type></typedef>
  1309. <typedef name="traits_type"><type>Traits</type></typedef>
  1310. <typedef name="int_type"><type>Traits::int_type</type></typedef>
  1311. <typedef name="pos_type"><type>Traits::pos_type</type></typedef>
  1312. <typedef name="off_type"><type>Traits::off_type</type></typedef>
  1313. <typedef name="native_handle"><type><emphasis>unspecified</emphasis></type></typedef>
  1314. <method-group name="public member functions">
  1315. <method name="native_source" cv="const"><type>native_handle</type><description><para>Get the native handle of the source. </para></description></method>
  1316. <method name="native_sink" cv="const"><type>native_handle</type><description><para>Get the native handle of the sink. </para></description></method>
  1317. <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>
  1318. <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>
  1319. <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>
  1320. <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>
  1321. <method name="is_open"><type>bool</type><purpose>Check if the pipe is open. </purpose></method>
  1322. <method name="close"><type>void</type><purpose>Close the pipe. </purpose></method>
  1323. </method-group>
  1324. <constructor><purpose>Default construct the pipe. Will be opened. </purpose></constructor>
  1325. <constructor specifiers="explicit"><parameter name="name"><paramtype>const std::string &amp;</paramtype></parameter><purpose>Construct a named pipe. </purpose></constructor>
  1326. <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>
  1327. </note>
  1328. </para></description></constructor>
  1329. <constructor><parameter name="lhs"><paramtype><classname>basic_pipe</classname> &amp;&amp;</paramtype></parameter><description><para>Move construct the pipe. </para></description></constructor>
  1330. <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>
  1331. </note>
  1332. </para></description></copy-assignment>
  1333. <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>
  1334. <destructor><description><para>Destructor closes the handles. </para></description></destructor>
  1335. </class><struct name="basic_pipebuf"><template>
  1336. <template-type-parameter name="CharT"/>
  1337. <template-type-parameter name="Traits"><default>std::char_traits&lt;CharT&gt;</default></template-type-parameter>
  1338. </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>
  1339. <typedef name="char_type"><type>CharT</type></typedef>
  1340. <typedef name="traits_type"><type>Traits</type></typedef>
  1341. <typedef name="int_type"><type>Traits::int_type</type></typedef>
  1342. <typedef name="pos_type"><type>Traits::pos_type</type></typedef>
  1343. <typedef name="off_type"><type>Traits::off_type</type></typedef>
  1344. <data-member name="default_buffer_size" specifiers="static"><type>constexpr int</type></data-member>
  1345. <method-group name="public member functions">
  1346. <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>
  1347. <method name="sync"><type>int</type><purpose>Synchronizes the buffers with the associated character sequence. </purpose></method>
  1348. <method name="underflow"><type>int_type</type><purpose>Reads characters from the associated input sequence to the get area. </purpose></method>
  1349. <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>
  1350. <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>
  1351. <method name="pipe"><type><classname>pipe_type</classname> &amp;</type><purpose>Get a reference to the pipe. </purpose></method>
  1352. <method name="pipe" cv="const"><type>const <classname>pipe_type</classname> &amp;</type><purpose>Get a const reference to the pipe. </purpose></method>
  1353. <method name="pipe"><type><classname>pipe_type</classname> &amp;&amp;</type><purpose>Get a rvalue reference to the pipe. Qualified as rvalue. </purpose></method>
  1354. <method name="is_open" cv="const"><type>bool</type><purpose>Check if the pipe is open. </purpose></method>
  1355. <method name="open"><type><classname>basic_pipebuf</classname>&lt; CharT, Traits &gt; *</type><purpose>Open a new pipe. </purpose></method>
  1356. <method name="open"><type><classname>basic_pipebuf</classname>&lt; CharT, Traits &gt; *</type><parameter name="name"><paramtype>const std::string &amp;</paramtype></parameter><purpose>Open a new named pipe. </purpose></method>
  1357. <method name="close"><type><classname>basic_pipebuf</classname>&lt; CharT, Traits &gt; *</type><purpose>Flush the buffer &amp; close the pipe. </purpose></method>
  1358. </method-group>
  1359. <constructor><purpose>Default constructor, will also construct the pipe. </purpose></constructor>
  1360. <constructor cv="= default"><parameter name=""><paramtype>const <classname>basic_pipebuf</classname> &amp;</paramtype></parameter><purpose>Copy Constructor. </purpose></constructor>
  1361. <constructor cv="= default"><parameter name=""><paramtype><classname>basic_pipebuf</classname> &amp;&amp;</paramtype></parameter><purpose>Move Constructor. </purpose></constructor>
  1362. <destructor><purpose>Destructor -&gt; writes the frest of the data. </purpose></destructor>
  1363. <constructor><parameter name="p"><paramtype><classname>pipe_type</classname> &amp;&amp;</paramtype></parameter><purpose>Move construct from a pipe. </purpose></constructor>
  1364. <constructor><parameter name="p"><paramtype>const <classname>pipe_type</classname> &amp;</paramtype></parameter><purpose>Construct from a pipe. </purpose></constructor>
  1365. <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>
  1366. <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>
  1367. <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>
  1368. <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>
  1369. <method-group name="private member functions">
  1370. <method name="_write_impl"><type>bool</type></method>
  1371. </method-group>
  1372. </struct><class name="basic_pstream"><template>
  1373. <template-type-parameter name="CharT"/>
  1374. <template-type-parameter name="Traits"><default>std::char_traits&lt;CharT&gt;</default></template-type-parameter>
  1375. </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>
  1376. <typedef name="char_type"><type>CharT</type></typedef>
  1377. <typedef name="traits_type"><type>Traits</type></typedef>
  1378. <typedef name="int_type"><type>Traits::int_type</type></typedef>
  1379. <typedef name="pos_type"><type>Traits::pos_type</type></typedef>
  1380. <typedef name="off_type"><type>Traits::off_type</type></typedef>
  1381. <method-group name="public member functions">
  1382. <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>
  1383. <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>
  1384. <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>
  1385. <method name="pipe"><type><classname>pipe_type</classname> &amp;</type><purpose>Get a reference to the pipe. </purpose></method>
  1386. <method name="pipe" cv="const"><type>const <classname>pipe_type</classname> &amp;</type><purpose>Get a const reference to the pipe. </purpose></method>
  1387. <method name="pipe"><type><classname>pipe_type</classname> &amp;&amp;</type><purpose>Get a rvalue reference to the pipe. Qualified as rvalue. </purpose></method>
  1388. <method name="open"><type>void</type><purpose>Open a new pipe. </purpose></method>
  1389. <method name="open"><type>void</type><parameter name="name"><paramtype>const std::string &amp;</paramtype></parameter><purpose>Open a new named pipe. </purpose></method>
  1390. <method name="close"><type>void</type><purpose>Flush the buffer &amp; close the pipe. </purpose></method>
  1391. </method-group>
  1392. <constructor><purpose>Default constructor. </purpose></constructor>
  1393. <constructor cv="= delete"><parameter name=""><paramtype>const <classname>basic_pstream</classname> &amp;</paramtype></parameter><purpose>Copy constructor. </purpose></constructor>
  1394. <constructor><parameter name="lhs"><paramtype><classname>basic_pstream</classname> &amp;&amp;</paramtype></parameter><purpose>Move constructor. </purpose></constructor>
  1395. <constructor><parameter name="p"><paramtype><classname>pipe_type</classname> &amp;&amp;</paramtype></parameter><purpose>Move construct from a pipe. </purpose></constructor>
  1396. <constructor><parameter name="p"><paramtype>const <classname>pipe_type</classname> &amp;</paramtype></parameter><purpose>Copy construct from a pipe. </purpose></constructor>
  1397. <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>
  1398. <copy-assignment><type><classname>basic_pstream</classname> &amp;</type><parameter name="lhs"><paramtype><classname>basic_pstream</classname> &amp;&amp;</paramtype></parameter><purpose>Move assignment. </purpose></copy-assignment>
  1399. <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>
  1400. <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>
  1401. </class><typedef name="pipe"><type><classname>basic_pipe</classname>&lt; char &gt;</type></typedef>
  1402. <typedef name="wpipe"><type><classname>basic_pipe</classname>&lt; wchar_t &gt;</type></typedef>
  1403. <typedef name="pipebuf"><type><classname>basic_pipebuf</classname>&lt; char &gt;</type></typedef>
  1404. <typedef name="wpipebuf"><type><classname>basic_pipebuf</classname>&lt; wchar_t &gt;</type></typedef>
  1405. <typedef name="ipstream"><type><classname>basic_ipstream</classname>&lt; char &gt;</type></typedef>
  1406. <typedef name="wipstream"><type><classname>basic_ipstream</classname>&lt; wchar_t &gt;</type></typedef>
  1407. <typedef name="opstream"><type><classname>basic_opstream</classname>&lt; char &gt;</type></typedef>
  1408. <typedef name="wopstream"><type><classname>basic_opstream</classname>&lt; wchar_t &gt;</type></typedef>
  1409. <typedef name="pstream"><type><classname>basic_pstream</classname>&lt; char &gt;</type></typedef>
  1410. <typedef name="wpstream"><type><classname>basic_pstream</classname>&lt; wchar_t &gt;</type></typedef>
  1411. </namespace>
  1412. </namespace>
  1413. </header>
  1414. <header name="boost/process/posix.hpp">
  1415. <para>Header which provides the posix extensions.
  1416. <programlisting language="c++">
  1417. namespace boost {
  1418. namespace process {
  1419. namespace posix {
  1420. <emphasis>unspecified</emphasis> <globalname alt="boost::process::posix::fd">fd</globalname>;
  1421. <emphasis>unspecified</emphasis> <globalname alt="boost::process::posix::sig">sig</globalname>;
  1422. <emphasis>unspecified</emphasis> <globalname alt="boost::process::posix::use_vfork">use_vfork</globalname>;
  1423. }
  1424. }
  1425. }
  1426. </programlisting>
  1427. <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>
  1428. </warning>
  1429. </para><namespace name="boost">
  1430. <namespace name="process">
  1431. <namespace name="posix">
  1432. <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>
  1433. <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;
  1434. sig(handler);
  1435. </programlisting></para><para><warning><para>spawn will automatically use <computeroutput>sig.ign()</computeroutput>, which will override if you pass a custom handler. </para>
  1436. </warning>
  1437. </para></description></data-member>
  1438. <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>
  1439. </note>
  1440. </para></description></data-member>
  1441. </namespace>
  1442. </namespace>
  1443. </namespace>
  1444. </header>
  1445. <header name="boost/process/search_path.hpp">
  1446. <para>Defines a function to search for an executable in path. </para><namespace name="boost">
  1447. <namespace name="process">
  1448. <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 to search, defaults to the "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>
  1449. </para></description><returns><para>the absolute path to the executable filename or an empty string if filename isn't found </para>
  1450. </returns></function>
  1451. </namespace>
  1452. </namespace>
  1453. </header>
  1454. <header name="boost/process/shell.hpp">
  1455. <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().
  1456. <programlisting language="c++">
  1457. namespace boost {
  1458. namespace process {
  1459. <emphasis>unspecified</emphasis> <globalname alt="boost::process::shell">shell</globalname>;
  1460. }
  1461. }
  1462. </programlisting>
  1463. </para><namespace name="boost">
  1464. <namespace name="process">
  1465. <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);
  1466. </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();
  1467. //avoid exceptions
  1468. std::error_code ec;
  1469. shell_cmd = shell(ec);
  1470. </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>
  1471. </note>
  1472. <note><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>
  1473. </note>
  1474. </para></description></data-member>
  1475. </namespace>
  1476. </namespace>
  1477. </header>
  1478. <header name="boost/process/spawn.hpp">
  1479. <para>Defines the spawn function. </para><namespace name="boost">
  1480. <namespace name="process">
  1481. <function name="spawn"><type>void</type><template>
  1482. <template-nontype-parameter name="Args"><type>typename ...</type></template-nontype-parameter>
  1483. </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>
  1484. </note>
  1485. <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_context</computeroutput> is passed. </para>
  1486. </warning>
  1487. </para></description></function>
  1488. </namespace>
  1489. </namespace>
  1490. </header>
  1491. <header name="boost/process/start_dir.hpp">
  1492. <para>Header which provides the start_dir property, which allows to set the directory the process shall be started in.
  1493. <programlisting language="c++">
  1494. namespace boost {
  1495. namespace process {
  1496. <emphasis>unspecified</emphasis> <globalname alt="boost::process::start_dir">start_dir</globalname>;
  1497. }
  1498. }
  1499. </programlisting>
  1500. </para><namespace name="boost">
  1501. <namespace name="process">
  1502. <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
  1503. start_dir(path)
  1504. </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>
  1505. </namespace>
  1506. </namespace>
  1507. </header>
  1508. <header name="boost/process/system.hpp">
  1509. <para>Defines a system function. </para><namespace name="boost">
  1510. <namespace name="process">
  1511. <function name="system"><type>int</type><template>
  1512. <template-nontype-parameter name="Args"><type>typename ...</type></template-nontype-parameter>
  1513. </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");
  1514. </programlisting></para><para><note><para>Using this function with synchronous pipes leads to many potential deadlocks.</para>
  1515. </note>
  1516. When using this function with an asynchronous properties and NOT passing an io_context object, the system function will create one and run it. When the io_context is passed to the function, the system function will check if it is active, and call the io_context::run function if not. </para></description></function>
  1517. </namespace>
  1518. </namespace>
  1519. </header>
  1520. <header name="boost/process/windows.hpp">
  1521. <para>Header which provides the windows extensions.</para><para>
  1522. <programlisting language="c++">
  1523. namespace boost {
  1524. namespace process {
  1525. namespace windows {
  1526. <emphasis>unspecified</emphasis> <globalname alt="boost::process::windows::hide">hide</globalname>;
  1527. <emphasis>unspecified</emphasis> <globalname alt="boost::process::windows::maximized">maximized</globalname>;
  1528. <emphasis>unspecified</emphasis> <globalname alt="boost::process::windows::minimized">minimized</globalname>;
  1529. <emphasis>unspecified</emphasis> <globalname alt="boost::process::windows::minimized_not_active">minimized_not_active</globalname>;
  1530. <emphasis>unspecified</emphasis> <globalname alt="boost::process::windows::not_active">not_active</globalname>;
  1531. <emphasis>unspecified</emphasis> <globalname alt="boost::process::windows::show">show</globalname>;
  1532. <emphasis>unspecified</emphasis> <globalname alt="boost::process::windows::show_normal">show_normal</globalname>;
  1533. <emphasis>unspecified</emphasis> <globalname alt="boost::process::windows::create_no_window">create_no_window</globalname>;
  1534. }
  1535. }
  1536. }
  1537. </programlisting>
  1538. <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>
  1539. </warning>
  1540. </para><namespace name="boost">
  1541. <namespace name="process">
  1542. <namespace name="windows">
  1543. <data-member name="hide"><type><emphasis>unspecified</emphasis></type><purpose>Hides the window and activates another window. </purpose></data-member>
  1544. <data-member name="maximized"><type><emphasis>unspecified</emphasis></type><purpose>Activates the window and displays it as a maximized window. </purpose></data-member>
  1545. <data-member name="minimized"><type><emphasis>unspecified</emphasis></type><purpose>Activates the window and displays it as a minimized window. </purpose></data-member>
  1546. <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>
  1547. <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>
  1548. <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>
  1549. <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>
  1550. <data-member name="create_no_window"><type><emphasis>unspecified</emphasis></type><purpose>Adds the <ulink url="https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx">CREATE_NO_WINDOW</ulink> flag. </purpose></data-member>
  1551. </namespace>
  1552. </namespace>
  1553. </namespace>
  1554. </header>
  1555. </library-reference>