autodoc.git / traditional_manual / chapter_27.html

version» Context lines:

autodoc.git/traditional_manual/chapter_27.html:27064:   <dl class='group--doc'>   <dt class='head--type'><span class='homogen--type'>Method</span>   <span class='homogen--name'><b>write</b></span>   </dt>   <dd><p><code><code class='datatype'>void</code> <b><span class='method'>write</span>(</b><code class='datatype'>string</code> <code class='argument'>bytes</code><b>)</b></code></p></dd>      <dt class='head--doc'>Description</dt>   <dd class='body--doc'><p>Add an input string to this pipe.</p>   </dd></dl>   </dd></dl></dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Process</b></h2> - </dt><dd><dl class='group--doc'> - <dt class='head--doc'>Description</dt> - <dd class='body--doc'><p>Easy and lazy way of using <code>Process.Process</code> that runs a process -  and returns a mapping with the output and exit code without -  having to make sure you read nonblocking yourself.</p> - </dd><dd class='body--doc'><p>Either a command line array, as the command_args -  argument to <code>create_process()</code>, or a string that -  will be splitted into a command line array by -  calling <code>split_quoted_string()</code> in an operating -  system dependant mode.</p> - </dd><dd class='body--doc'><p>It takes all the modifiers <code>Process.Process</code> accepts, with -  the exception of stdout and stderr. Each must be either absent, or -  a function accepting a string; if present, the functions will be called -  whenever output is made on the corresponding stream, otherwise the data -  will be collected and returned in the result mapping.</p> - <p> If <code class='expr'>modifiers-&gt;stdin</code> is set to a string it will automatically be -  converted to a pipe that is fed to stdin of the started process.</p> - </dd> - <dt class='head--doc'>See also</dt> - <dd class='body--doc'><p><code>Process.Process</code> <code>create_process</code></p> - </dd><dd class='body--doc'><table class='box'><tr><td><code><code class='key'>"stdout"</code> : <code class='datatype'>string</code></code></td><td><p>Everything the process wrote on stdout, unless a stdout function was -  provided.</p> - </td></tr> - <tr><td><code><code class='key'>"stderr"</code> : <code class='datatype'>string</code></code></td><td><p>Everything the process wrote on stderr, similarly.</p> - </td></tr> - <tr><td><code><code class='key'>"exitcode"</code> : <code class='datatype'>int</code></code></td><td><p>The process' exitcode.</p> - </td></tr> - </table> - </dd> - <dt class='head--doc'>Note</dt> - <dd class='body--doc'><p>As the entire output of stderr and stdout is stored in the -  returned mapping it could potentially grow until memory runs out. -  It is therefore advisable to set up rlimits if the output has a -  potential to be very large, or else provide functions to handle -  partial data.</p> - </dd> - <dt class='head--doc'>Example</dt> - <dd class='example'><pre><p>Process.run( ({ "ls", "-l" }) ); -  Process.run( ({ "ls", "-l" }), ([ "cwd":"/etc" ]) ); -  Process.run( "ls -l" ); -  Process.run( "awk -F: '{print $2}'", ([ "stdin":"foo:2\nbar:17\n" ]) ); -  Process.run( ({ "echo Output will be immediately written to stdout" }), -  ([ "stdout": lambda(string s) { write(s); }, -  "stderr": lambda(string e) { werror(e); } ]) );</p> - </pre></dd></dl> + </dt><dd>      <hr />   <dl class='group--doc'>   <dt class='head--type'><span class='homogen--type'>Method</span>   <span class='homogen--name'><b>daemon</b></span>   </dt>   <dd><p><code><code class='datatype'>void</code> <b><span class='method'>daemon</span>(</b><code class='datatype'>int</code> <code class='argument'>nochdir</code>, <code class='datatype'>int</code> <code class='argument'>noclose</code>, <code class='datatype'>void</code>|<code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>string</code>|<code class='object unresolved'>Stdio.File</code>) <code class='argument'>modifiers</code><b>)</b></code></p></dd>      <dt class='head--doc'>Description</dt>   <dd class='body--doc'><p>A function to run current program in the background.</p>
autodoc.git/traditional_manual/chapter_27.html:27238:   </table>   </dd>   <dt class='head--doc'>See also</dt>   <dd class='body--doc'><p><code>system</code>, <code>spawn</code></p>   </dd></dl>         <hr />   <dl class='group--doc'>   <dt class='head--type'><span class='homogen--type'>Method</span> + <span class='homogen--name'><b>run</b></span> + </dt> + <dd><p><code><code class='datatype'>mapping</code> <b><span class='method'>run</span>(</b><code class='datatype'>string</code>|<code class='datatype'>array</code>(<code class='datatype'>string</code>) <code class='argument'>cmd</code>, <code class='datatype'>mapping</code>|<code class='datatype'>void</code> <code class='argument'>modifiers</code><b>)</b></code></p></dd> +  + <dt class='head--doc'>Description</dt> + <dd class='body--doc'><p>Easy and lazy way of using <code>Process.Process</code> that runs a process +  and returns a mapping with the output and exit code without +  having to make sure you read nonblocking yourself.</p> + </dd> + <dt class='head--doc'><span id='p-args'></span>Parameter <code class='parameter'>args</code></dt> + <dd></dd><dd class='body--doc'><p>Either a command line array, as the command_args +  argument to <code>create_process()</code>, or a string that +  will be splitted into a command line array by +  calling <code>split_quoted_string()</code> in an operating +  system dependant mode.</p> + </dd> + <dt class='head--doc'><span id='p-modifiers'></span>Parameter <code class='parameter'>modifiers</code></dt> + <dd></dd><dd class='body--doc'><p>It takes all the modifiers <code>Process.Process</code> accepts, with +  the exception of stdout and stderr. Each must be either absent, or +  a function accepting a string; if present, the functions will be called +  whenever output is made on the corresponding stream, otherwise the data +  will be collected and returned in the result mapping.</p> + <p> If <code class='expr'>modifiers-&gt;stdin</code> is set to a string it will automatically be +  converted to a pipe that is fed to stdin of the started process.</p> + </dd> + <dt class='head--doc'>See also</dt> + <dd class='body--doc'><p><code>Process.Process</code> <code>create_process</code></p> + </dd> + <dt class='head--doc'>Returns</dt> + <dd class='body--doc'><table class='box'><tr><td><code><code class='key'>"stdout"</code> : <code class='datatype'>string</code></code></td><td><p>Everything the process wrote on stdout, unless a stdout function was +  provided.</p> + </td></tr> + <tr><td><code><code class='key'>"stderr"</code> : <code class='datatype'>string</code></code></td><td><p>Everything the process wrote on stderr, similarly.</p> + </td></tr> + <tr><td><code><code class='key'>"exitcode"</code> : <code class='datatype'>int</code></code></td><td><p>The process' exitcode.</p> + </td></tr> + </table> + </dd> + <dt class='head--doc'>Note</dt> + <dd class='body--doc'><p>As the entire output of stderr and stdout is stored in the +  returned mapping it could potentially grow until memory runs out. +  It is therefore advisable to set up rlimits if the output has a +  potential to be very large, or else provide functions to handle +  partial data.</p> + </dd> + <dt class='head--doc'>Example</dt> + <dd class='example'><pre><p>Process.run( ({ "ls", "-l" }) ); +  Process.run( ({ "ls", "-l" }), ([ "cwd":"/etc" ]) ); +  Process.run( "ls -l" ); +  Process.run( "awk -F: '{print $2}'", ([ "stdin":"foo:2\nbar:17\n" ]) ); +  Process.run( ({ "echo Output will be immediately written to stdout" }), +  ([ "stdout": lambda(string s) { write(s); }, +  "stderr": lambda(string e) { werror(e); } ]) );</p> + </pre></dd></dl> +  +  + <hr /> + <dl class='group--doc'> + <dt class='head--type'><span class='homogen--type'>Method</span>   <span class='homogen--name'><b>search_path</b></span>   </dt>   <dd><p><code><code class='datatype'>string</code> <b><span class='method'>search_path</span>(</b><code class='datatype'>string</code> <code class='argument'>command</code><b>)</b></code></p></dd>      <dt class='head--doc'>Description</dt>   <dd class='body--doc'><p>Search for the path to an executable.</p>   </dd>   <dt class='head--doc'><span id='p-command'></span>Parameter <code class='parameter'>command</code></dt>   <dd></dd><dd class='body--doc'><p>Executable to search for.</p>   <p> Searches for <code>command</code> in the directories listed in the
autodoc.git/traditional_manual/chapter_27.html:41343:    <code>ext</code> as the extension payload. If the <code>critical</code> flag is set    the extension will be marked as critical.</p>   </dd></dl>         <hr />   <dl class='group--doc'>   <dt class='head--type'><span class='homogen--type'>Method</span>   <span class='homogen--name'><b>make_selfsigned_certificate</b></span>   </dt> - <dd><p><code><code class='datatype'>string</code> <b><span class='method'>make_selfsigned_certificate</span>(</b><code class='object unresolved'>Crypto.Sign.State</code> <code class='argument'>c</code>, <code class='datatype'>int</code> <code class='argument'>ttl</code>, <code class='datatype'>mapping</code>|<code class='datatype'>array</code> <code class='argument'>name</code>, <code class='datatype'>mapping</code>(<code class='object unresolved'>Identifier</code>:<code class='object unresolved'>Sequence</code>)|<code class='datatype'>void</code> <code class='argument'>extensions</code>, <code class='datatype'>void</code>|<code class='object unresolved'>Crypto.Hash</code> <code class='argument'>h</code>, <code class='datatype'>void</code>|<code class='datatype'>int</code> <code class='argument'>serial</code><b>)</b></code></p></dd> + <dd><p><code><code class='datatype'>string</code> <b><span class='method'>make_selfsigned_certificate</span>(</b><code class='object unresolved'>Crypto.Sign.State</code> <code class='argument'>c</code>, <code class='datatype'>int</code> <code class='argument'>ttl</code>, <code class='datatype'>mapping</code>|<code class='datatype'>array</code> <code class='argument'>name</code>, <code class='datatype'>mapping</code>(<code class='object unresolved'>Identifier</code>:<code class='object unresolved'>Sequence</code>)|<code class='datatype'>void</code> <code class='argument'>extensions</code>, <code class='object unresolved'>Crypto.Hash</code>|<code class='datatype'>void</code> <code class='argument'>h</code>, <code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>serial</code><b>)</b></code></p></dd>      <dt class='head--doc'>Description</dt>   <dd class='body--doc'><p>Creates a selfsigned certificate, i.e. where issuer and subject    are the same entity. This entity is derived from the list of pairs    in <code>name</code>, which is encoded into an distinguished_name by    <code>Standards.PKCS.Certificate.build_distinguished_name</code>.</p>   </dd>   <dt class='head--doc'><span id='p-c'></span>Parameter <code class='parameter'>c</code></dt>   <dd></dd><dd class='body--doc'><p>The public key cipher used for the certificate, <code>Crypto.RSA</code>,    <code>Crypto.DSA</code> or <code>Crypto.ECC.Curve.ECDSA</code>. The object should be