autodoc.git / modref / ex / predef_3A_3A / Process.html

version» Context lines:

autodoc.git/modref/ex/predef_3A_3A/Process.html:54:    <nav>    <div class="sidebar">    <a href="../../ex/predef_3A_3A/Postgres/postgres_result/seek.html" class="prev"><span>&#10148;</span> Postgres.postgres_result()-&gt;seek()</a>    <a href="../../ex/predef_3A_3A/Process/ForkdDecoder.html" class="next">Process.ForkdDecoder <span>&#10148;</span></a>    </div>    </nav>    </div>    <div class="contentbox">    <article>    <h1>Module Process</h1> -  <dl class='group--doc'> - <dt class='head--doc'>Description</dt> - <dd class='body--doc'><p>Easy and lazy way of using <a class='ms reference' href='../predef_3A_3A/Process/Process.html'>Process.Process</a> 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 <a class='ms reference' href='../predef_3A_3A/Process/create_process.html'>create_process()</a>, or a string that -  will be splitted into a command line array by -  calling <a class='ms reference' href='../predef_3A_3A/Process/split_quoted_string.html'>split_quoted_string()</a> in an operating -  system dependant mode.</p> - </dd><dd class='body--doc'><p>It takes all the modifiers <a class='ms reference' href='../predef_3A_3A/Process/Process.html'>Process.Process</a> 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><a class='ms reference' href='../predef_3A_3A/Process/Process.html'>Process.Process</a> <a class='ms reference' href='../predef_3A_3A/Process/create_process.html'>create_process</a></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> +     </article>    </div>    </div>    </div>    <footer>    <div id="build-date">Extracted from <strong data-id="version"></strong> as of <strong data-id="date" data-timestamp=""></strong>.</div>    </footer>    <script>PikeDoc.current = {"link":"ex/predef_3A_3A/Process.html","name":"Process"};</script>   <script src='../../ex/predef_3A_3A/index.js'></script>   <script src='../../ex/predef_3A_3A/Process/load_index.js'></script>    <script>    // Tell PikeDoc that next actions are from loaded scripts    PikeDoc.isInline = false;    </script>    </body>   </html>