Files
Nim/osproc.html
github-actions[bot] de413ab6bb Deploy to GitHub pages
2025-12-25 20:14:24 +00:00

877 lines
97 KiB
HTML

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/osproc</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/osproc</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#Process" title="Process = ref ProcessObj">Process</a></li>
<li><a class="reference" href="#ProcessOption" title="ProcessOption = enum
poEchoCmd, ## Echo the command before execution.
poUsePath, ## Asks system to search for executable using PATH environment
## variable.
## On Windows, this is the default.
poEvalCommand, ## Pass `command` directly to the shell, without quoting.
## Use it only if `command` comes from trusted source.
poStdErrToStdOut, ## Merge stdout and stderr to the stdout stream.
poParentStreams, ## Use the parent's streams.
poInteractive, ## Optimize the buffer handling for responsiveness for
## UI applications. Currently this only affects
## Windows: Named pipes are used so that you can peek
## at the process' output streams.
poDaemon ## Windows: The program creates no Window.
## Unix: Start the program as a daemon. This is still
## work in progress!">ProcessOption</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">close
<li><a class="reference" href="#close%2CProcess" title="close(p: Process)">close(p: Process)</a></li>
</ul>
<ul class="simple nested-toc-section">countProcessors
<li><a class="reference" href="#countProcessors" title="countProcessors(): int">countProcessors(): int</a></li>
</ul>
<ul class="simple nested-toc-section">errorHandle
<li><a class="reference" href="#errorHandle%2CProcess" title="errorHandle(p: Process): FileHandle">errorHandle(p: Process): FileHandle</a></li>
</ul>
<ul class="simple nested-toc-section">errorStream
<li><a class="reference" href="#errorStream%2CProcess" title="errorStream(p: Process): Stream">errorStream(p: Process): Stream</a></li>
</ul>
<ul class="simple nested-toc-section">execCmd
<li><a class="reference" href="#execCmd%2Cstring" title="execCmd(command: string): int">execCmd(command: string): int</a></li>
</ul>
<ul class="simple nested-toc-section">execCmdEx
<li><a class="reference" href="#execCmdEx%2Cstring%2Cset%5BProcessOption%5D%2CStringTableRef%2Cstring%2Cstring" title="execCmdEx(command: string;
options: set[ProcessOption] = {poStdErrToStdOut, poUsePath};
env: StringTableRef = nil; workingDir = &quot;&quot;; input = &quot;&quot;): tuple[
output: string, exitCode: int]">execCmdEx(command: string;
options: set[ProcessOption] = {poStdErrToStdOut, poUsePath};
env: StringTableRef = nil; workingDir = &quot;&quot;; input = &quot;&quot;): tuple[
output: string, exitCode: int]</a></li>
</ul>
<ul class="simple nested-toc-section">execProcess
<li><a class="reference" href="#execProcess%2Cstring%2Cstring%2CopenArray%5Bstring%5D%2CStringTableRef%2Cset%5BProcessOption%5D" title="execProcess(command: string; workingDir: string = &quot;&quot;;
args: openArray[string] = []; env: StringTableRef = nil; options: set[
ProcessOption] = {poStdErrToStdOut, poUsePath, poEvalCommand}): string">execProcess(command: string; workingDir: string = &quot;&quot;;
args: openArray[string] = []; env: StringTableRef = nil; options: set[
ProcessOption] = {poStdErrToStdOut, poUsePath, poEvalCommand}): string</a></li>
</ul>
<ul class="simple nested-toc-section">execProcesses
<li><a class="reference" href="#execProcesses%2CopenArray%5Bstring%5D%2Cproc%28int%29%2Cproc%28int%2CProcess%29" title="execProcesses(cmds: openArray[string];
options = {poStdErrToStdOut, poParentStreams};
n = countProcessors(); beforeRunEvent: proc (idx: int) = nil;
afterRunEvent: proc (idx: int; p: Process) = nil): int">execProcesses(cmds: openArray[string];
options = {poStdErrToStdOut, poParentStreams};
n = countProcessors(); beforeRunEvent: proc (idx: int) = nil;
afterRunEvent: proc (idx: int; p: Process) = nil): int</a></li>
</ul>
<ul class="simple nested-toc-section">hasData
<li><a class="reference" href="#hasData%2CProcess" title="hasData(p: Process): bool">hasData(p: Process): bool</a></li>
</ul>
<ul class="simple nested-toc-section">inputHandle
<li><a class="reference" href="#inputHandle%2CProcess" title="inputHandle(p: Process): FileHandle">inputHandle(p: Process): FileHandle</a></li>
</ul>
<ul class="simple nested-toc-section">inputStream
<li><a class="reference" href="#inputStream%2CProcess" title="inputStream(p: Process): Stream">inputStream(p: Process): Stream</a></li>
</ul>
<ul class="simple nested-toc-section">kill
<li><a class="reference" href="#kill%2CProcess" title="kill(p: Process)">kill(p: Process)</a></li>
</ul>
<ul class="simple nested-toc-section">outputHandle
<li><a class="reference" href="#outputHandle%2CProcess" title="outputHandle(p: Process): FileHandle">outputHandle(p: Process): FileHandle</a></li>
</ul>
<ul class="simple nested-toc-section">outputStream
<li><a class="reference" href="#outputStream%2CProcess" title="outputStream(p: Process): Stream">outputStream(p: Process): Stream</a></li>
</ul>
<ul class="simple nested-toc-section">peekableErrorStream
<li><a class="reference" href="#peekableErrorStream%2CProcess" title="peekableErrorStream(p: Process): Stream">peekableErrorStream(p: Process): Stream</a></li>
</ul>
<ul class="simple nested-toc-section">peekableOutputStream
<li><a class="reference" href="#peekableOutputStream%2CProcess" title="peekableOutputStream(p: Process): Stream">peekableOutputStream(p: Process): Stream</a></li>
</ul>
<ul class="simple nested-toc-section">peekExitCode
<li><a class="reference" href="#peekExitCode%2CProcess" title="peekExitCode(p: Process): int">peekExitCode(p: Process): int</a></li>
</ul>
<ul class="simple nested-toc-section">processID
<li><a class="reference" href="#processID%2CProcess" title="processID(p: Process): int">processID(p: Process): int</a></li>
</ul>
<ul class="simple nested-toc-section">readLines
<li><a class="reference" href="#readLines%2CProcess" title="readLines(p: Process): (seq[string], int)">readLines(p: Process): (seq[string], int)</a></li>
</ul>
<ul class="simple nested-toc-section">resume
<li><a class="reference" href="#resume%2CProcess" title="resume(p: Process)">resume(p: Process)</a></li>
</ul>
<ul class="simple nested-toc-section">running
<li><a class="reference" href="#running%2CProcess" title="running(p: Process): bool">running(p: Process): bool</a></li>
</ul>
<ul class="simple nested-toc-section">startProcess
<li><a class="reference" href="#startProcess%2Cstring%2Cstring%2CopenArray%5Bstring%5D%2CStringTableRef%2Cset%5BProcessOption%5D" title="startProcess(command: string; workingDir: string = &quot;&quot;;
args: openArray[string] = []; env: StringTableRef = nil;
options: set[ProcessOption] = {poStdErrToStdOut}): owned(Process)">startProcess(command: string; workingDir: string = &quot;&quot;;
args: openArray[string] = []; env: StringTableRef = nil;
options: set[ProcessOption] = {poStdErrToStdOut}): owned(Process)</a></li>
</ul>
<ul class="simple nested-toc-section">suspend
<li><a class="reference" href="#suspend%2CProcess" title="suspend(p: Process)">suspend(p: Process)</a></li>
</ul>
<ul class="simple nested-toc-section">terminate
<li><a class="reference" href="#terminate%2CProcess" title="terminate(p: Process)">terminate(p: Process)</a></li>
</ul>
<ul class="simple nested-toc-section">waitForExit
<li><a class="reference" href="#waitForExit%2CProcess%2Cint" title="waitForExit(p: Process; timeout: int = -1): int">waitForExit(p: Process; timeout: int = -1): int</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#15" id="65">Iterators</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">lines
<li><a class="reference" href="#lines.i%2CProcess" title="lines(p: Process; keepNewLines = false): string">lines(p: Process; keepNewLines = false): string</a></li>
</ul>
</ul>
</details>
</li>
<li>
<a class="reference reference-toplevel" href="#19" id="69">Exports</a>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"><p>This module implements an advanced facility for executing OS processes and process communication.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="os.html">os module</a></li>
<li><a class="reference external" href="streams.html">streams module</a></li>
<li><a class="reference external" href="memfiles.html">memfiles module</a></li>
</ul>
</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="strutils.html">strutils</a>, <a class="reference external" href="os.html">os</a>, <a class="reference external" href="strtabs.html">strtabs</a>, <a class="reference external" href="streams.html">streams</a>, <a class="reference external" href="cpuinfo.html">cpuinfo</a>, <a class="reference external" href="streamwrapper.html">streamwrapper</a>, <a class="reference external" href="since.html">since</a>, <a class="reference external" href="posix.html">posix</a>, <a class="reference external" href="syncio.html">syncio</a>, <a class="reference external" href="assertions.html">assertions</a>, <a class="reference external" href="times.html">times</a>, <a class="reference external" href="monotimes.html">monotimes</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="Process">
<dt><pre><a href="osproc.html#Process"><span class="Identifier">Process</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Identifier">ProcessObj</span></pre></dt>
<dd>
Represents an operating system process.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L73" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L73" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="ProcessOption">
<dt><pre><a href="osproc.html#ProcessOption"><span class="Identifier">ProcessOption</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">poEchoCmd</span><span class="Other">,</span> <span class="Comment">## Echo the command before execution.</span>
<span class="Identifier">poUsePath</span><span class="Other">,</span> <span class="Comment">## Asks system to search for executable using PATH environment</span>
<span class="Comment">## variable.</span>
<span class="Comment">## On Windows, this is the default.</span>
<span class="Identifier">poEvalCommand</span><span class="Other">,</span> <span class="Comment">## Pass `command` directly to the shell, without quoting.</span>
<span class="Comment">## Use it only if `command` comes from trusted source.</span>
<span class="Identifier">poStdErrToStdOut</span><span class="Other">,</span> <span class="Comment">## Merge stdout and stderr to the stdout stream.</span>
<span class="Identifier">poParentStreams</span><span class="Other">,</span> <span class="Comment">## Use the parent's streams.</span>
<span class="Identifier">poInteractive</span><span class="Other">,</span> <span class="Comment">## Optimize the buffer handling for responsiveness for</span>
<span class="Comment">## UI applications. Currently this only affects</span>
<span class="Comment">## Windows: Named pipes are used so that you can peek</span>
<span class="Comment">## at the process' output streams.</span>
<span class="Identifier">poDaemon</span> <span class="Comment">## Windows: The program creates no Window.</span>
<span class="Comment">## Unix: Start the program as a daemon. This is still</span>
<span class="Comment">## work in progress!</span></pre></dt>
<dd>
Options that can be passed to <a class="reference external" href="#startProcess,string,string,openArray[string],StringTableRef,set[ProcessOption]">startProcess proc</a>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L41" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L41" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="close-procs-all">
<div id="close,Process">
<dt><pre><span class="Keyword">proc</span> <a href="#close%2CProcess"><span class="Identifier">close</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#IOError"><span class="Identifier">IOError</span></a><span class="Other">,</span> <a href="exceptions.html#OSError"><span class="Identifier">OSError</span></a><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#WriteIOEffect"><span class="Identifier">WriteIOEffect</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
When the process has finished executing, cleanup related handles.<div class="admonition admonition-warning"><span class="admonition-warning-text"><b>Warning:</b></span>
If the process has not finished executing, this will forcibly terminate the process. Doing so may result in zombie processes and <a class="reference external" href="https://stackoverflow.com/questions/27021641/how-to-fix-request-failed-on-channel-0">pty leaks</a>.</div>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L155" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L155" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="countProcessors-procs-all">
<div id="countProcessors">
<dt><pre><span class="Keyword">proc</span> <a href="#countProcessors"><span class="Identifier">countProcessors</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns the number of the processors/cores the machine has. Returns 0 if it cannot be detected. It is implemented just calling <tt class="docutils literal"><span class="pre"><span class="Identifier">cpuinfo</span><span class="Operator">.</span><span class="Identifier">countProcessors</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L332" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L332" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="errorHandle-procs-all">
<div id="errorHandle,Process">
<dt><pre><span class="Keyword">proc</span> <a href="#errorHandle%2CProcess"><span class="Identifier">errorHandle</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">)</span><span class="Other">:</span> <a href="syncio.html#FileHandle"><span class="Identifier">FileHandle</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns <tt class="docutils literal"><span class="pre">p</span></tt>'s error file handle for reading from.<div class="admonition admonition-warning"><span class="admonition-warning-text"><b>Warning:</b></span>
The returned <tt class="docutils literal"><span class="pre"><span class="Identifier">FileHandle</span></span></tt> should not be closed manually as it is closed when closing the Process <tt class="docutils literal"><span class="pre">p</span></tt>.</div>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#inputHandle,Process">inputHandle proc</a></li>
<li><a class="reference external" href="#outputHandle,Process">outputHandle proc</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L320" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L320" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="errorStream-procs-all">
<div id="errorStream,Process">
<dt><pre><span class="Keyword">proc</span> <a href="#errorStream%2CProcess"><span class="Identifier">errorStream</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">)</span><span class="Other">:</span> <a href="streams.html#Stream"><span class="Identifier">Stream</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Returns <tt class="docutils literal"><span class="pre">p</span></tt>'s error stream for reading from.</p>
<p>You cannot perform peek/write/setOption operations to this stream. Use <a class="reference external" href="#peekableErrorStream,Process">peekableErrorStream proc</a> if you need to peek stream.</p>
<div class="admonition admonition-warning"><span class="admonition-warning-text"><b>Warning:</b></span>
The returned <tt class="docutils literal"><span class="pre"><span class="Identifier">Stream</span></span></tt> should not be closed manually as it is closed when closing the Process <tt class="docutils literal"><span class="pre">p</span></tt>.</div>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#inputStream,Process">inputStream proc</a></li>
<li><a class="reference external" href="#outputStream,Process">outputStream proc</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L258" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L258" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="execCmd-procs-all">
<div id="execCmd,string">
<dt><pre><span class="Keyword">proc</span> <a href="#execCmd%2Cstring"><span class="Identifier">execCmd</span></a><span class="Other">(</span><span class="Identifier">command</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<a href="exceptions.html#ExecIOEffect"><span class="Identifier">ExecIOEffect</span></a><span class="Other">,</span> <a href="exceptions.html#ReadIOEffect"><span class="Identifier">ReadIOEffect</span></a><span class="Other">,</span> <a href="system.html#RootEffect"><span class="Identifier">RootEffect</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Executes <tt class="docutils literal"><span class="pre">command</span></tt> and returns its error code.</p>
<p>Standard input, output, error streams are inherited from the calling process. This operation is also often called <span id="system_1">system</span>.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#execCmdEx,string,set[ProcessOption],StringTableRef,string,string">execCmdEx proc</a></li>
<li><a class="reference external" href="#startProcess,string,string,openArray[string],StringTableRef,set[ProcessOption]">startProcess proc</a></li>
<li><a class="reference external" href="#execProcess,string,string,openArray[string],StringTableRef,set[ProcessOption]">execProcess proc</a></li>
</ul>
<p>Example:</p>
<p><pre class="listing"><span class="Keyword">let</span> <span class="Identifier">errC</span> <span class="Operator">=</span> <span class="Identifier">execCmd</span><span class="Punctuation">(</span><span class="StringLit">&quot;nim c -r mytestfile.nim&quot;</span><span class="Punctuation">)</span></pre></p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L101" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L101" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="execCmdEx-procs-all">
<div id="execCmdEx,string,set[ProcessOption],StringTableRef,string,string">
<dt><pre><span class="Keyword">proc</span> <a href="#execCmdEx%2Cstring%2Cset%5BProcessOption%5D%2CStringTableRef%2Cstring%2Cstring"><span class="Identifier">execCmdEx</span></a><span class="Other">(</span><span class="Identifier">command</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span>
<span class="Identifier">options</span><span class="Other">:</span> <a href="system.html#set"><span class="Identifier">set</span></a><span class="Other">[</span><a href="osproc.html#ProcessOption"><span class="Identifier">ProcessOption</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Identifier">poStdErrToStdOut</span><span class="Other">,</span> <span class="Identifier">poUsePath</span><span class="Other">}</span><span class="Other">;</span>
<span class="Identifier">env</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span> <span class="Identifier">workingDir</span> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">;</span> <span class="Identifier">input</span> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">tuple</span><span class="Other">[</span>
<span class="Identifier">output</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">,</span> <span class="Identifier">exitCode</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#OSError"><span class="Identifier">OSError</span></a><span class="Other">,</span> <a href="exceptions.html#IOError"><span class="Identifier">IOError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<a href="exceptions.html#ExecIOEffect"><span class="Identifier">ExecIOEffect</span></a><span class="Other">,</span> <a href="exceptions.html#ReadIOEffect"><span class="Identifier">ReadIOEffect</span></a><span class="Other">,</span> <a href="system.html#RootEffect"><span class="Identifier">RootEffect</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>A convenience proc that runs the <tt class="docutils literal"><span class="pre"><span class="Identifier">command</span></span></tt>, and returns its <tt class="docutils literal"><span class="pre"><span class="Identifier">output</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">exitCode</span></span></tt>. <tt class="docutils literal"><span class="pre"><span class="Identifier">env</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">workingDir</span></span></tt> params behave as for <tt class="docutils literal"><span class="pre"><span class="Identifier">startProcess</span></span></tt>. If <tt class="docutils literal"><span class="pre"><span class="Identifier">input</span><span class="Operator">.</span><span class="Identifier">len</span> <span class="Operator">&gt;</span> <span class="DecNumber">0</span></span></tt>, it is passed as stdin.</p>
<p>Note: this could block if <tt class="docutils literal"><span class="pre"><span class="Identifier">input</span><span class="Operator">.</span><span class="Identifier">len</span></span></tt> is greater than your OS's maximum pipe buffer size.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#execCmd,string">execCmd proc</a></li>
<li><a class="reference external" href="#startProcess,string,string,openArray[string],StringTableRef,set[ProcessOption]">startProcess proc</a></li>
<li><a class="reference external" href="#execProcess,string,string,openArray[string],StringTableRef,set[ProcessOption]">execProcess proc</a></li>
</ul>
<p>Example:</p>
<p><pre class="listing"><span class="Keyword">var</span> <span class="Identifier">result</span> <span class="Operator">=</span> <span class="Identifier">execCmdEx</span><span class="Punctuation">(</span><span class="StringLit">&quot;nim r --hints:off -&quot;</span><span class="Punctuation">,</span> <span class="Identifier">options</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="Punctuation">}</span><span class="Punctuation">,</span> <span class="Identifier">input</span> <span class="Operator">=</span> <span class="StringLit">&quot;echo 3*4&quot;</span><span class="Punctuation">)</span>
<span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Punctuation">[</span><span class="Identifier">strutils</span><span class="Punctuation">,</span> <span class="Identifier">strtabs</span><span class="Punctuation">]</span>
<span class="Identifier">stripLineEnd</span><span class="Punctuation">(</span><span class="Identifier">result</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">]</span><span class="Punctuation">)</span> <span class="Comment">## portable way to remove trailing newline, if any</span>
<span class="Identifier">doAssert</span> <span class="Identifier">result</span> <span class="Operator">==</span> <span class="Punctuation">(</span><span class="StringLit">&quot;12&quot;</span><span class="Punctuation">,</span> <span class="DecNumber">0</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Identifier">execCmdEx</span><span class="Punctuation">(</span><span class="StringLit">&quot;ls --nonexistent&quot;</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">exitCode</span> <span class="Operator">!=</span> <span class="DecNumber">0</span>
<span class="Keyword">when</span> <span class="Identifier">defined</span><span class="Punctuation">(</span><span class="Identifier">posix</span><span class="Punctuation">)</span><span class="Punctuation">:</span>
<span class="Identifier">assert</span> <span class="Identifier">execCmdEx</span><span class="Punctuation">(</span><span class="StringLit">&quot;echo $FO&quot;</span><span class="Punctuation">,</span> <span class="Identifier">env</span> <span class="Operator">=</span> <span class="Identifier">newStringTable</span><span class="Punctuation">(</span><span class="Punctuation">{</span><span class="StringLit">&quot;FO&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;B&quot;</span><span class="Punctuation">}</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Punctuation">(</span><span class="StringLit">&quot;B</span><span class="EscapeSequence">\n</span><span class="StringLit">&quot;</span><span class="Punctuation">,</span> <span class="DecNumber">0</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">execCmdEx</span><span class="Punctuation">(</span><span class="StringLit">&quot;echo $PWD&quot;</span><span class="Punctuation">,</span> <span class="Identifier">workingDir</span> <span class="Operator">=</span> <span class="StringLit">&quot;/&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Punctuation">(</span><span class="StringLit">&quot;/</span><span class="EscapeSequence">\n</span><span class="StringLit">&quot;</span><span class="Punctuation">,</span> <span class="DecNumber">0</span><span class="Punctuation">)</span></pre></p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L1522" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L1522" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="execProcess-procs-all">
<div id="execProcess,string,string,openArray[string],StringTableRef,set[ProcessOption]">
<dt><pre><span class="Keyword">proc</span> <a href="#execProcess%2Cstring%2Cstring%2CopenArray%5Bstring%5D%2CStringTableRef%2Cset%5BProcessOption%5D"><span class="Identifier">execProcess</span></a><span class="Other">(</span><span class="Identifier">command</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">workingDir</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">;</span>
<span class="Identifier">args</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">env</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
<span class="Identifier">options</span><span class="Other">:</span> <a href="system.html#set"><span class="Identifier">set</span></a><span class="Other">[</span><a href="osproc.html#ProcessOption"><span class="Identifier">ProcessOption</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Identifier">poStdErrToStdOut</span><span class="Other">,</span> <span class="Identifier">poUsePath</span><span class="Other">,</span> <span class="Identifier">poEvalCommand</span><span class="Other">}</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#OSError"><span class="Identifier">OSError</span></a><span class="Other">,</span> <a href="exceptions.html#IOError"><span class="Identifier">IOError</span></a><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#ExecIOEffect"><span class="Identifier">ExecIOEffect</span></a><span class="Other">,</span> <a href="exceptions.html#ReadIOEffect"><span class="Identifier">ReadIOEffect</span></a><span class="Other">,</span> <a href="system.html#RootEffect"><span class="Identifier">RootEffect</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
A convenience procedure that executes <tt class="docutils literal"><span class="pre">command</span></tt> with <tt class="docutils literal"><span class="pre">startProcess</span></tt> and returns its output as a string.<div class="admonition admonition-warning"><span class="admonition-warning-text"><b>Warning:</b></span>
This function uses <tt class="docutils literal"><span class="pre"><span class="Identifier">poEvalCommand</span></span></tt> by default for backwards compatibility. Make sure to pass options explicitly.</div>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#startProcess,string,string,openArray[string],StringTableRef,set[ProcessOption]">startProcess proc</a></li>
<li><a class="reference external" href="#execProcesses,openArray[string],proc(int),proc(int,Process)">execProcesses proc</a></li>
<li><a class="reference external" href="#execCmd,string">execCmd proc</a></li>
</ul>
<p>Example:</p>
<p><pre class="listing"><span class="Keyword">let</span> <span class="Identifier">outp</span> <span class="Operator">=</span> <span class="Identifier">execProcess</span><span class="Punctuation">(</span><span class="StringLit">&quot;nim&quot;</span><span class="Punctuation">,</span> <span class="Identifier">args</span><span class="Operator">=</span><span class="Punctuation">[</span><span class="StringLit">&quot;c&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;-r&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;mytestfile.nim&quot;</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="Identifier">options</span><span class="Operator">=</span><span class="Punctuation">{</span><span class="Identifier">poUsePath</span><span class="Punctuation">}</span><span class="Punctuation">)</span>
<span class="Keyword">let</span> <span class="Identifier">outp_shell</span> <span class="Operator">=</span> <span class="Identifier">execProcess</span><span class="Punctuation">(</span><span class="StringLit">&quot;nim c -r mytestfile.nim&quot;</span><span class="Punctuation">)</span>
<span class="Comment"># Note: outp may have an interleave of text from the nim compile</span>
<span class="Comment"># and any output from mytestfile when it runs</span></pre></p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L76" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L76" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="execProcesses-procs-all">
<div id="execProcesses,openArray[string],proc(int),proc(int,Process)">
<dt><pre><span class="Keyword">proc</span> <a href="#execProcesses%2CopenArray%5Bstring%5D%2Cproc%28int%29%2Cproc%28int%2CProcess%29"><span class="Identifier">execProcesses</span></a><span class="Other">(</span><span class="Identifier">cmds</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">options</span> <span class="Other">=</span> <span class="Other">{</span><span class="Identifier">poStdErrToStdOut</span><span class="Other">,</span> <span class="Identifier">poParentStreams</span><span class="Other">}</span><span class="Other">;</span>
<span class="Identifier">n</span> <span class="Other">=</span> <span class="Identifier">countProcessors</span><span class="Other">(</span><span class="Other">)</span><span class="Other">;</span> <span class="Identifier">beforeRunEvent</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">idx</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
<span class="Identifier">afterRunEvent</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">idx</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">;</span> <span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">)</span> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#ValueError"><span class="Identifier">ValueError</span></a><span class="Other">,</span> <a href="exceptions.html#OSError"><span class="Identifier">OSError</span></a><span class="Other">,</span> <a href="exceptions.html#IOError"><span class="Identifier">IOError</span></a><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#ExecIOEffect"><span class="Identifier">ExecIOEffect</span></a><span class="Other">,</span> <a href="exceptions.html#TimeEffect"><span class="Identifier">TimeEffect</span></a><span class="Other">,</span> <a href="envvars.html#ReadEnvEffect"><span class="Identifier">ReadEnvEffect</span></a><span class="Other">,</span> <a href="system.html#RootEffect"><span class="Identifier">RootEffect</span></a><span class="Other">]</span><span class="Other">,</span>
</span><span class="Identifier">effectsOf</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">beforeRunEvent</span><span class="Other">,</span> <span class="Identifier">afterRunEvent</span><span class="Other">]</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Executes the commands <tt class="docutils literal"><span class="pre"><span class="Identifier">cmds</span></span></tt> in parallel. Creates <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> processes that execute in parallel.</p>
<p>The highest (absolute) return value of all processes is returned. Runs <tt class="docutils literal"><span class="pre"><span class="Identifier">beforeRunEvent</span></span></tt> before running each command.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L341" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L341" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="hasData-procs-all">
<div id="hasData,Process">
<dt><pre><span class="Keyword">proc</span> <a href="#hasData%2CProcess"><span class="Identifier">hasData</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L1512" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L1512" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="inputHandle-procs-all">
<div id="inputHandle,Process">
<dt><pre><span class="Keyword">proc</span> <a href="#inputHandle%2CProcess"><span class="Identifier">inputHandle</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">)</span><span class="Other">:</span> <a href="syncio.html#FileHandle"><span class="Identifier">FileHandle</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns <tt class="docutils literal"><span class="pre">p</span></tt>'s input file handle for writing to.<div class="admonition admonition-warning"><span class="admonition-warning-text"><b>Warning:</b></span>
The returned <tt class="docutils literal"><span class="pre"><span class="Identifier">FileHandle</span></span></tt> should not be closed manually as it is closed when closing the Process <tt class="docutils literal"><span class="pre">p</span></tt>.</div>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#outputHandle,Process">outputHandle proc</a></li>
<li><a class="reference external" href="#errorHandle,Process">errorHandle proc</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L296" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L296" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="inputStream-procs-all">
<div id="inputStream,Process">
<dt><pre><span class="Keyword">proc</span> <a href="#inputStream%2CProcess"><span class="Identifier">inputStream</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">)</span><span class="Other">:</span> <a href="streams.html#Stream"><span class="Identifier">Stream</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns <tt class="docutils literal"><span class="pre">p</span></tt>'s input stream for writing to.<div class="admonition admonition-warning"><span class="admonition-warning-text"><b>Warning:</b></span>
The returned <tt class="docutils literal"><span class="pre"><span class="Identifier">Stream</span></span></tt> should not be closed manually as it is closed when closing the Process <tt class="docutils literal"><span class="pre">p</span></tt>.</div>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#outputStream,Process">outputStream proc</a></li>
<li><a class="reference external" href="#errorStream,Process">errorStream proc</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L234" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L234" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="kill-procs-all">
<div id="kill,Process">
<dt><pre><span class="Keyword">proc</span> <a href="#kill%2CProcess"><span class="Identifier">kill</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Kill the process <tt class="docutils literal"><span class="pre"><span class="Identifier">p</span></span></tt>.</p>
<p>On Posix OSes the procedure sends <tt class="docutils literal"><span class="pre">SIGKILL</span></tt> to the process. On Windows <tt class="docutils literal"><span class="pre">kill</span></tt> is simply an alias for <a class="reference external" href="#terminate,Process">terminate()</a>.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#suspend,Process">suspend proc</a></li>
<li><a class="reference external" href="#resume,Process">resume proc</a></li>
<li><a class="reference external" href="#terminate,Process">terminate proc</a></li>
<li><a class="reference external" href="posix_utils.html#sendSignal,Pid,int">posix_utils.sendSignal(pid: Pid, signal: int)</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L192" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L192" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="outputHandle-procs-all">
<div id="outputHandle,Process">
<dt><pre><span class="Keyword">proc</span> <a href="#outputHandle%2CProcess"><span class="Identifier">outputHandle</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">)</span><span class="Other">:</span> <a href="syncio.html#FileHandle"><span class="Identifier">FileHandle</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns <tt class="docutils literal"><span class="pre">p</span></tt>'s output file handle for reading from.<div class="admonition admonition-warning"><span class="admonition-warning-text"><b>Warning:</b></span>
The returned <tt class="docutils literal"><span class="pre"><span class="Identifier">FileHandle</span></span></tt> should not be closed manually as it is closed when closing the Process <tt class="docutils literal"><span class="pre">p</span></tt>.</div>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#inputHandle,Process">inputHandle proc</a></li>
<li><a class="reference external" href="#errorHandle,Process">errorHandle proc</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L308" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L308" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="outputStream-procs-all">
<div id="outputStream,Process">
<dt><pre><span class="Keyword">proc</span> <a href="#outputStream%2CProcess"><span class="Identifier">outputStream</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">)</span><span class="Other">:</span> <a href="streams.html#Stream"><span class="Identifier">Stream</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#IOError"><span class="Identifier">IOError</span></a><span class="Other">,</span> <a href="exceptions.html#OSError"><span class="Identifier">OSError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Returns <tt class="docutils literal"><span class="pre">p</span></tt>'s output stream for reading from.</p>
<p>You cannot perform peek/write/setOption operations to this stream. Use <a class="reference external" href="#peekableOutputStream,Process">peekableOutputStream proc</a> if you need to peek stream.</p>
<div class="admonition admonition-warning"><span class="admonition-warning-text"><b>Warning:</b></span>
The returned <tt class="docutils literal"><span class="pre"><span class="Identifier">Stream</span></span></tt> should not be closed manually as it is closed when closing the Process <tt class="docutils literal"><span class="pre">p</span></tt>.</div>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#inputStream,Process">inputStream proc</a></li>
<li><a class="reference external" href="#errorStream,Process">errorStream proc</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L244" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L244" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="peekableErrorStream-procs-all">
<div id="peekableErrorStream,Process">
<dt><pre><span class="Keyword">proc</span> <a href="#peekableErrorStream%2CProcess"><span class="Identifier">peekableErrorStream</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">)</span><span class="Other">:</span> <a href="streams.html#Stream"><span class="Identifier">Stream</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Returns <tt class="docutils literal"><span class="pre">p</span></tt>'s error stream for reading from.</p>
<p>You can run peek operation to returned stream.</p>
<div class="admonition admonition-warning"><span class="admonition-warning-text"><b>Warning:</b></span>
The returned <tt class="docutils literal"><span class="pre"><span class="Identifier">Stream</span></span></tt> should not be closed manually as it is closed when closing the Process <tt class="docutils literal"><span class="pre">p</span></tt>.</div>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#errorStream,Process">errorStream proc</a></li>
<li><a class="reference external" href="#peekableOutputStream,Process">peekableOutputStream proc</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L284" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L284" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="peekableOutputStream-procs-all">
<div id="peekableOutputStream,Process">
<dt><pre><span class="Keyword">proc</span> <a href="#peekableOutputStream%2CProcess"><span class="Identifier">peekableOutputStream</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">)</span><span class="Other">:</span> <a href="streams.html#Stream"><span class="Identifier">Stream</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Returns <tt class="docutils literal"><span class="pre">p</span></tt>'s output stream for reading from.</p>
<p>You can peek returned stream.</p>
<div class="admonition admonition-warning"><span class="admonition-warning-text"><b>Warning:</b></span>
The returned <tt class="docutils literal"><span class="pre"><span class="Identifier">Stream</span></span></tt> should not be closed manually as it is closed when closing the Process <tt class="docutils literal"><span class="pre">p</span></tt>.</div>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#outputStream,Process">outputStream proc</a></li>
<li><a class="reference external" href="#peekableErrorStream,Process">peekableErrorStream proc</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L272" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L272" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="peekExitCode-procs-all">
<div id="peekExitCode,Process">
<dt><pre><span class="Keyword">proc</span> <a href="#peekExitCode%2CProcess"><span class="Identifier">peekExitCode</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#OSError"><span class="Identifier">OSError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Return <tt class="docutils literal"><span class="pre"><span class="Operator">-</span><span class="DecNumber">1</span></span></tt> if the process is still running. Otherwise the process' exit code.</p>
<p>On posix, if the process has exited because of a signal, 128 + signal number will be returned.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L228" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L228" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="processID-procs-all">
<div id="processID,Process">
<dt><pre><span class="Keyword">proc</span> <a href="#processID%2CProcess"><span class="Identifier">processID</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Returns <tt class="docutils literal"><span class="pre"><span class="Identifier">p</span></span></tt>'s process ID.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="os.html#getCurrentProcessId">os.getCurrentProcessId proc</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L207" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L207" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="readLines-procs-all">
<div id="readLines,Process">
<dt><pre><span class="Keyword">proc</span> <a href="#readLines%2CProcess"><span class="Identifier">readLines</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Other">(</span><a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span><span class="Other">,</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#OSError"><span class="Identifier">OSError</span></a><span class="Other">,</span> <a href="exceptions.html#IOError"><span class="Identifier">IOError</span></a><span class="Other">,</span> <a href="exceptions.html#ValueError"><span class="Identifier">ValueError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#ReadIOEffect"><span class="Identifier">ReadIOEffect</span></a><span class="Other">,</span> <a href="exceptions.html#TimeEffect"><span class="Identifier">TimeEffect</span></a><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Convenience function for working with <tt class="docutils literal"><span class="pre"><span class="Identifier">startProcess</span></span></tt> to read data from a background process.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#lines.i,Process">lines iterator</a></li>
</ul>
<p>Example:</p>
<p><pre class="listing"><span class="Keyword">const</span> <span class="Identifier">opts</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="Identifier">poUsePath</span><span class="Punctuation">,</span> <span class="Identifier">poDaemon</span><span class="Punctuation">,</span> <span class="Identifier">poStdErrToStdOut</span><span class="Punctuation">}</span>
<span class="Keyword">var</span> <span class="Identifier">ps</span><span class="Punctuation">:</span> <span class="Identifier">seq</span><span class="Punctuation">[</span><span class="Identifier">Process</span><span class="Punctuation">]</span>
<span class="Keyword">for</span> <span class="Identifier">prog</span> <span class="Keyword">in</span> <span class="Punctuation">[</span><span class="StringLit">&quot;a&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;b&quot;</span><span class="Punctuation">]</span><span class="Punctuation">:</span> <span class="Comment"># run 2 progs in parallel</span>
<span class="Identifier">ps</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">startProcess</span><span class="Punctuation">(</span><span class="StringLit">&quot;nim&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;&quot;</span><span class="Punctuation">,</span> <span class="Punctuation">[</span><span class="StringLit">&quot;r&quot;</span><span class="Punctuation">,</span> <span class="Identifier">prog</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="Keyword">nil</span><span class="Punctuation">,</span> <span class="Identifier">opts</span><span class="Punctuation">)</span>
<span class="Keyword">for</span> <span class="Identifier">p</span> <span class="Keyword">in</span> <span class="Identifier">ps</span><span class="Punctuation">:</span>
<span class="Keyword">let</span> <span class="Punctuation">(</span><span class="Identifier">lines</span><span class="Punctuation">,</span> <span class="Identifier">exCode</span><span class="Punctuation">)</span> <span class="Operator">=</span> <span class="Identifier">p</span><span class="Operator">.</span><span class="Identifier">readLines</span>
<span class="Keyword">if</span> <span class="Identifier">exCode</span> <span class="Operator">!=</span> <span class="DecNumber">0</span><span class="Punctuation">:</span>
<span class="Keyword">for</span> <span class="Identifier">line</span> <span class="Keyword">in</span> <span class="Identifier">lines</span><span class="Punctuation">:</span> <span class="Identifier">echo</span> <span class="Identifier">line</span>
<span class="Identifier">p</span><span class="Operator">.</span><span class="Identifier">close</span></pre></p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L489" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L489" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="resume-procs-all">
<div id="resume,Process">
<dt><pre><span class="Keyword">proc</span> <a href="#resume%2CProcess"><span class="Identifier">resume</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Resumes the process <tt class="docutils literal"><span class="pre"><span class="Identifier">p</span></span></tt>.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#suspend,Process">suspend proc</a></li>
<li><a class="reference external" href="#terminate,Process">terminate proc</a></li>
<li><a class="reference external" href="#kill,Process">kill proc</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L171" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L171" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="running-procs-all">
<div id="running,Process">
<dt><pre><span class="Keyword">proc</span> <a href="#running%2CProcess"><span class="Identifier">running</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#OSError"><span class="Identifier">OSError</span></a><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns true if the process <tt class="docutils literal"><span class="pre"><span class="Identifier">p</span></span></tt> is still running. Returns immediately.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L204" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L204" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="startProcess-procs-all">
<div id="startProcess,string,string,openArray[string],StringTableRef,set[ProcessOption]">
<dt><pre><span class="Keyword">proc</span> <a href="#startProcess%2Cstring%2Cstring%2CopenArray%5Bstring%5D%2CStringTableRef%2Cset%5BProcessOption%5D"><span class="Identifier">startProcess</span></a><span class="Other">(</span><span class="Identifier">command</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">workingDir</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">;</span>
<span class="Identifier">args</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">env</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
<span class="Identifier">options</span><span class="Other">:</span> <a href="system.html#set"><span class="Identifier">set</span></a><span class="Other">[</span><a href="osproc.html#ProcessOption"><span class="Identifier">ProcessOption</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Identifier">poStdErrToStdOut</span><span class="Other">}</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span>
<span class="Identifier">Process</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#OSError"><span class="Identifier">OSError</span></a><span class="Other">,</span> <a href="exceptions.html#IOError"><span class="Identifier">IOError</span></a><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#ExecIOEffect"><span class="Identifier">ExecIOEffect</span></a><span class="Other">,</span> <a href="envvars.html#ReadEnvEffect"><span class="Identifier">ReadEnvEffect</span></a><span class="Other">,</span> <a href="system.html#RootEffect"><span class="Identifier">RootEffect</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Starts a process. <tt class="docutils literal"><span class="pre"><span class="Identifier">Command</span></span></tt> is the executable file, <tt class="docutils literal"><span class="pre"><span class="Identifier">workingDir</span></span></tt> is the process's working directory. If <tt class="docutils literal"><span class="pre">workingDir == &quot;&quot;</span></tt> the current directory is used (default). <tt class="docutils literal"><span class="pre"><span class="Identifier">args</span></span></tt> are the command line arguments that are passed to the process. On many operating systems, the first command line argument is the name of the executable. <tt class="docutils literal"><span class="pre"><span class="Identifier">args</span></span></tt> should <em>not</em> contain this argument! <tt class="docutils literal"><span class="pre"><span class="Identifier">env</span></span></tt> is the environment that will be passed to the process. If <tt class="docutils literal"><span class="pre">env == nil</span></tt> (default) the environment is inherited of the parent process. <tt class="docutils literal"><span class="pre"><span class="Identifier">options</span></span></tt> are additional flags that may be passed to <tt class="docutils literal"><span class="pre"><span class="Identifier">startProcess</span></span></tt>. See the documentation of <a class="reference external" href="#ProcessOption">ProcessOption</a> for the meaning of these flags.</p>
<p>You need to <a class="reference external" href="#close,Process">close</a> the process when done.</p>
<p>Note that you can't pass any <tt class="docutils literal"><span class="pre"><span class="Identifier">args</span></span></tt> if you use the option <tt class="docutils literal"><span class="pre">poEvalCommand</span></tt>, which invokes the system shell to run the specified <tt class="docutils literal"><span class="pre"><span class="Identifier">command</span></span></tt>. In this situation you have to concatenate manually the contents of <tt class="docutils literal"><span class="pre"><span class="Identifier">args</span></span></tt> to <tt class="docutils literal"><span class="pre"><span class="Identifier">command</span></span></tt> carefully escaping/quoting any special characters, since it will be passed <em>as is</em> to the system shell. Each system/shell may feature different escaping rules, so try to avoid this kind of shell invocation if possible as it leads to non portable software.</p>
<p>Return value: The newly created process object. Nil is never returned, but <tt class="docutils literal"><span class="pre">OSError</span></tt> is raised in case of an error.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#execProcesses,openArray[string],proc(int),proc(int,Process)">execProcesses proc</a></li>
<li><a class="reference external" href="#execProcess,string,string,openArray[string],StringTableRef,set[ProcessOption]">execProcess proc</a></li>
<li><a class="reference external" href="#execCmd,string">execCmd proc</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L120" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L120" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="suspend-procs-all">
<div id="suspend,Process">
<dt><pre><span class="Keyword">proc</span> <a href="#suspend%2CProcess"><span class="Identifier">suspend</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Suspends the process <tt class="docutils literal"><span class="pre"><span class="Identifier">p</span></span></tt>.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#resume,Process">resume proc</a></li>
<li><a class="reference external" href="#terminate,Process">terminate proc</a></li>
<li><a class="reference external" href="#kill,Process">kill proc</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L162" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L162" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="terminate-procs-all">
<div id="terminate,Process">
<dt><pre><span class="Keyword">proc</span> <a href="#terminate%2CProcess"><span class="Identifier">terminate</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Stop the process <tt class="docutils literal"><span class="pre"><span class="Identifier">p</span></span></tt>.</p>
<p>On Posix OSes the procedure sends <tt class="docutils literal"><span class="pre">SIGTERM</span></tt> to the process. On Windows the Win32 API function <tt class="docutils literal"><span class="pre">TerminateProcess()</span></tt> is called to stop the process.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#suspend,Process">suspend proc</a></li>
<li><a class="reference external" href="#resume,Process">resume proc</a></li>
<li><a class="reference external" href="#kill,Process">kill proc</a></li>
<li><a class="reference external" href="posix_utils.html#sendSignal,Pid,int">posix_utils.sendSignal(pid: Pid, signal: int)</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L179" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L179" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="waitForExit-procs-all">
<div id="waitForExit,Process,int">
<dt><pre><span class="Keyword">proc</span> <a href="#waitForExit%2CProcess%2Cint"><span class="Identifier">waitForExit</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">;</span> <span class="Identifier">timeout</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> <span class="Other">=</span> <span class="DecNumber">-1</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nosp$1&quot;</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#OSError"><span class="Identifier">OSError</span></a><span class="Other">,</span> <a href="exceptions.html#ValueError"><span class="Identifier">ValueError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#TimeEffect"><span class="Identifier">TimeEffect</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Waits for the process to finish and returns <tt class="docutils literal"><span class="pre"><span class="Identifier">p</span></span></tt>'s error code.<div class="admonition admonition-warning"><span class="admonition-warning-text"><b>Warning:</b></span>
Be careful when using <tt class="docutils literal"><span class="pre"><span class="Identifier">waitForExit</span></span></tt> for processes created without <tt class="docutils literal"><span class="pre"><span class="Identifier">poParentStreams</span></span></tt> because they may fill output buffers, causing deadlock.</div>
<p>On posix, if the process has exited because of a signal, 128 + signal number will be returned.</p>
<div class="admonition admonition-warning"><span class="admonition-warning-text"><b>Warning:</b></span>
When working with <tt class="docutils literal"><span class="pre"><span class="Identifier">timeout</span></span></tt> parameters, remember that the value is typically expressed in milliseconds, and ensure that the correct unit of time is used to avoid unexpected behavior.</div>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L214" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L214" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="15">
<h1><a class="toc-backref" href="#15">Iterators</a></h1>
<dl class="item">
<div id="lines-iterators-all">
<div id="lines.i,Process">
<dt><pre><span class="Keyword">iterator</span> <a href="#lines.i%2CProcess"><span class="Identifier">lines</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="osproc.html#Process"><span class="Identifier">Process</span></a><span class="Other">;</span> <span class="Identifier">keepNewLines</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#OSError"><span class="Identifier">OSError</span></a><span class="Other">,</span> <a href="exceptions.html#IOError"><span class="Identifier">IOError</span></a><span class="Other">,</span> <a href="exceptions.html#ValueError"><span class="Identifier">ValueError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#ReadIOEffect"><span class="Identifier">ReadIOEffect</span></a><span class="Other">,</span> <a href="exceptions.html#TimeEffect"><span class="Identifier">TimeEffect</span></a><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Convenience iterator for working with <tt class="docutils literal"><span class="pre"><span class="Identifier">startProcess</span></span></tt> to read data from a background process.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="#readLines,Process">readLines proc</a></li>
</ul>
<p>Example:</p>
<p><pre class="listing"><span class="Keyword">const</span> <span class="Identifier">opts</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="Identifier">poUsePath</span><span class="Punctuation">,</span> <span class="Identifier">poDaemon</span><span class="Punctuation">,</span> <span class="Identifier">poStdErrToStdOut</span><span class="Punctuation">}</span>
<span class="Keyword">var</span> <span class="Identifier">ps</span><span class="Punctuation">:</span> <span class="Identifier">seq</span><span class="Punctuation">[</span><span class="Identifier">Process</span><span class="Punctuation">]</span>
<span class="Keyword">for</span> <span class="Identifier">prog</span> <span class="Keyword">in</span> <span class="Punctuation">[</span><span class="StringLit">&quot;a&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;b&quot;</span><span class="Punctuation">]</span><span class="Punctuation">:</span> <span class="Comment"># run 2 progs in parallel</span>
<span class="Identifier">ps</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">startProcess</span><span class="Punctuation">(</span><span class="StringLit">&quot;nim&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;&quot;</span><span class="Punctuation">,</span> <span class="Punctuation">[</span><span class="StringLit">&quot;r&quot;</span><span class="Punctuation">,</span> <span class="Identifier">prog</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="Keyword">nil</span><span class="Punctuation">,</span> <span class="Identifier">opts</span><span class="Punctuation">)</span>
<span class="Keyword">for</span> <span class="Identifier">p</span> <span class="Keyword">in</span> <span class="Identifier">ps</span><span class="Punctuation">:</span>
<span class="Keyword">var</span> <span class="Identifier">i</span> <span class="Operator">=</span> <span class="DecNumber">0</span>
<span class="Keyword">for</span> <span class="Identifier">line</span> <span class="Keyword">in</span> <span class="Identifier">p</span><span class="Operator">.</span><span class="Identifier">lines</span><span class="Punctuation">:</span>
<span class="Identifier">echo</span> <span class="Identifier">line</span>
<span class="Identifier">i</span><span class="Operator">.</span><span class="Identifier">inc</span>
<span class="Keyword">if</span> <span class="Identifier">i</span> <span class="Operator">&gt;</span> <span class="DecNumber">100</span><span class="Punctuation">:</span> <span class="Keyword">break</span>
<span class="Identifier">p</span><span class="Operator">.</span><span class="Identifier">close</span></pre></p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/osproc.nim#L460" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/osproc.nim#L460" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="19">
<h1><a class="toc-backref" href="#19">Exports</a></h1>
<dl class="item">
<a href="os.html#quoteShell,string"><span class="Identifier">quoteShell</span></a>, <a href="os.html#quoteShellWindows,string"><span class="Identifier">quoteShellWindows</span></a>, <a href="os.html#quoteShellPosix,string"><span class="Identifier">quoteShellPosix</span></a>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-12-25 20:13:40 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>