Files
SwiftShell/Protocols/CommandRunning.html
2019-03-28 15:49:36 +01:00

786 lines
39 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="en">
<head>
<title>CommandRunning Protocol Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Protocol/CommandRunning" class="dashAnchor"></a>
<a title="CommandRunning Protocol Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">SwiftShell Docs</a> (72% documented)</p>
<p class="header-right"><a href="https://github.com/kareman/SwiftShell"><img src="../img/gh.png"/>View on GitHub</a></p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html">SwiftShell Reference</a>
<img id="carat" src="../img/carat.png" />
CommandRunning Protocol Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/AsyncCommand.html">AsyncCommand</a>
</li>
<li class="nav-group-task">
<a href="../Classes/FileHandleStream.html">FileHandleStream</a>
</li>
<li class="nav-group-task">
<a href="../Classes/MainContext.html">MainContext</a>
</li>
<li class="nav-group-task">
<a href="../Classes/PrintedAsyncCommand.html">PrintedAsyncCommand</a>
</li>
<li class="nav-group-task">
<a href="../Classes/RunOutput.html">RunOutput</a>
</li>
<li class="nav-group-task">
<a href="../Classes/StdoutStream.html">StdoutStream</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Global Variables.html">Global Variables</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Global Variables.html#/s:10SwiftShell5FilesSo13NSFileManagerCvp">Files</a>
</li>
<li class="nav-group-task">
<a href="../Global Variables.html#/s:10SwiftShell4mainAA11MainContextCvp">main</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/CommandError.html">CommandError</a>
</li>
<li class="nav-group-task">
<a href="../Enums/FileError.html">FileError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/FileHandle.html">FileHandle</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/FileHandle.html">FileHandle</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/LazyCollectionProtocol.html">LazyCollectionProtocol</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Process.html">Process</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Process.html">Process</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Functions.html">Functions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Functions.html#/s:10SwiftShell1poiy10Foundation3URLVAE_SStF">+(_:_:)</a>
</li>
<li class="nav-group-task">
<a href="../Functions.html#/s:10SwiftShell4exit_4file4lines5NeverOs5Error_p_SSSitF">exit(_:file:line:)</a>
</li>
<li class="nav-group-task">
<a href="../Functions.html#/s:10SwiftShell4exit12errormessage9errorcode4file4lines5NeverOx_SiSSSitlF">exit(errormessage:errorcode:file:line:)</a>
</li>
<li class="nav-group-task">
<a href="../Functions.html#/s:10SwiftShell4open_8encodingAA14ReadableStream_p10Foundation3URLV_SSAEE8EncodingVtKF">open(_:encoding:)</a>
</li>
<li class="nav-group-task">
<a href="../Functions.html#/s:10SwiftShell4open_8encodingAA14ReadableStream_pSS_SS10FoundationE8EncodingVtKF">open(_:encoding:)</a>
</li>
<li class="nav-group-task">
<a href="../Functions.html#/s:10SwiftShell4open10forWriting9overwrite8encodingAA14WritableStream_p10Foundation3URLV_SbSSAGE8EncodingVtKF">open(forWriting:overwrite:encoding:)</a>
</li>
<li class="nav-group-task">
<a href="../Functions.html#/s:10SwiftShell4open10forWriting9overwrite8encodingAA14WritableStream_pSS_SbSS10FoundationE8EncodingVtKF">open(forWriting:overwrite:encoding:)</a>
</li>
<li class="nav-group-task">
<a href="../Functions.html#/s:10SwiftShell3run__13combineOutputAA03RunE0CSS_ypdSbtF">run(_:_:combineOutput:)</a>
</li>
<li class="nav-group-task">
<a href="../Functions.html#/s:10SwiftShell3run4bash13combineOutputAA03RunF0CSS_SbtF">run(bash:combineOutput:)</a>
</li>
<li class="nav-group-task">
<a href="../Functions.html#/s:10SwiftShell11runAndPrintyySS_ypdtKF">runAndPrint(_:_:)</a>
</li>
<li class="nav-group-task">
<a href="../Functions.html#/s:10SwiftShell11runAndPrint4bashySS_tKF">runAndPrint(bash:)</a>
</li>
<li class="nav-group-task">
<a href="../Functions.html#/s:10SwiftShell8runAsync__4file4lineAA0D7CommandCSS_ypdSSSitF">runAsync(_:_:file:line:)</a>
</li>
<li class="nav-group-task">
<a href="../Functions.html#/s:10SwiftShell8runAsync4bash4file4lineAA0D7CommandCSS_SSSitF">runAsync(bash:file:line:)</a>
</li>
<li class="nav-group-task">
<a href="../Functions.html#/s:10SwiftShell16runAsyncAndPrint__4file4lineAA07PrintedD7CommandCSS_ypdSSSitF">runAsyncAndPrint(_:_:file:line:)</a>
</li>
<li class="nav-group-task">
<a href="../Functions.html#/s:10SwiftShell16runAsyncAndPrint4bash4file4lineAA07PrintedD7CommandCSS_SSSitF">runAsyncAndPrint(bash:file:line:)</a>
</li>
<li class="nav-group-task">
<a href="../Functions.html#/s:10SwiftShell7streamsAA14WritableStream_p_AA08ReadableE0_ptyF">streams()</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols.html#/CommandRunning">CommandRunning</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/CommandRunning.html">CommandRunning</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/Context.html">Context</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/ReadableStream.html">ReadableStream</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/WritableStream.html">WritableStream</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/CustomContext.html">CustomContext</a>
</li>
<li class="nav-group-task">
<a href="../Structs/LazySplitSequence.html">LazySplitSequence</a>
</li>
<li class="nav-group-task">
<a href="../Structs/PartialSourceLazySplitSequence.html">PartialSourceLazySplitSequence</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>CommandRunning</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">CommandRunning</span></code></pre>
</div>
</div>
<p>Can run commands.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:10SwiftShell14CommandRunningP7contextAA7Context_pvp"></a>
<a name="//apple_ref/swift/Property/context" class="dashAnchor"></a>
<a class="token" href="#/s:10SwiftShell14CommandRunningP7contextAA7Context_pvp">context</a>
</code>
<span class="declaration-note">
Default implementation
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Undocumented</p>
</div>
<h4>Default Implementation</h4>
<div class="default_impl abstract">
<p>Undocumented</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">var</span> <span class="nv">context</span><span class="p">:</span> <span class="kt"><a href="../Protocols/Context.html">Context</a></span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/Bash"></a>
<a name="//apple_ref/swift/Section/Bash" class="dashAnchor"></a>
<a href="#/Bash">
<h3 class="section-name">Bash</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/s:10SwiftShell14CommandRunningPAAE3run4bash13combineOutputAA03RunH0CSS_SbtF"></a>
<a name="//apple_ref/swift/Method/run(bash:combineOutput:)" class="dashAnchor"></a>
<a class="token" href="#/s:10SwiftShell14CommandRunningPAAE3run4bash13combineOutputAA03RunH0CSS_SbtF">run(bash:combineOutput:)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Runs a bash shell command.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">@discardableResult</span>
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">run</span><span class="p">(</span><span class="n">bash</span> <span class="nv">bashcommand</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">combineOutput</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/RunOutput.html">RunOutput</a></span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>bashcommand</em>
</code>
</td>
<td>
<div>
<p>the bash shell command.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>combineOutput</em>
</code>
</td>
<td>
<div>
<p>if true then stdout and stderror go to the same stream. Default is false.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:10SwiftShell14CommandRunningPAAE8runAsync4bash4file4lineAA0fC0CSS_SSSitF"></a>
<a name="//apple_ref/swift/Method/runAsync(bash:file:line:)" class="dashAnchor"></a>
<a class="token" href="#/s:10SwiftShell14CommandRunningPAAE8runAsync4bash4file4lineAA0fC0CSS_SSSitF">runAsync(bash:file:line:)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Runs bash command and returns before it is finished.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">runAsync</span><span class="p">(</span><span class="n">bash</span> <span class="nv">bashcommand</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">file</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="kd">#file</span><span class="p">,</span> <span class="nv">line</span><span class="p">:</span> <span class="kt">Int</span> <span class="o">=</span> <span class="kd">#line</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/AsyncCommand.html">AsyncCommand</a></span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>bashcommand</em>
</code>
</td>
<td>
<div>
<p>the bash shell command.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:10SwiftShell14CommandRunningPAAE16runAsyncAndPrint4bash4file4lineAA07PrintedfC0CSS_SSSitF"></a>
<a name="//apple_ref/swift/Method/runAsyncAndPrint(bash:file:line:)" class="dashAnchor"></a>
<a class="token" href="#/s:10SwiftShell14CommandRunningPAAE16runAsyncAndPrint4bash4file4lineAA07PrintedfC0CSS_SSSitF">runAsyncAndPrint(bash:file:line:)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Runs bash command and returns before it is finished.
Any output is printed to standard output and standard error, respectively.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">runAsyncAndPrint</span><span class="p">(</span><span class="n">bash</span> <span class="nv">bashcommand</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">file</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="kd">#file</span><span class="p">,</span> <span class="nv">line</span><span class="p">:</span> <span class="kt">Int</span> <span class="o">=</span> <span class="kd">#line</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/PrintedAsyncCommand.html">PrintedAsyncCommand</a></span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>bashcommand</em>
</code>
</td>
<td>
<div>
<p>the bash shell command.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:10SwiftShell14CommandRunningPAAE11runAndPrint4bashySS_tKF"></a>
<a name="//apple_ref/swift/Method/runAndPrint(bash:)" class="dashAnchor"></a>
<a class="token" href="#/s:10SwiftShell14CommandRunningPAAE11runAndPrint4bashySS_tKF">runAndPrint(bash:)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Runs bash command and prints output and errors.</p>
<div class="aside aside-throws">
<p class="aside-title">Throws</p>
a CommandError.returnedErrorCode if the return code is anything but 0.
</div>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">runAndPrint</span><span class="p">(</span><span class="n">bash</span> <span class="nv">bashcommand</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="k">throws</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>bashcommand</em>
</code>
</td>
<td>
<div>
<p>the bash shell command.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/run"></a>
<a name="//apple_ref/swift/Section/run" class="dashAnchor"></a>
<a href="#/run">
<h3 class="section-name">run</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/s:10SwiftShell14CommandRunningPAAE3run__13combineOutputAA03RunG0CSS_ypdSbtF"></a>
<a name="//apple_ref/swift/Method/run(_:_:combineOutput:)" class="dashAnchor"></a>
<a class="token" href="#/s:10SwiftShell14CommandRunningPAAE3run__13combineOutputAA03RunG0CSS_ypdSbtF">run(_:_:combineOutput:)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Runs a command.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">@discardableResult</span>
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">run</span><span class="p">(</span><span class="n">_</span> <span class="nv">executable</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="n">_</span> <span class="nv">args</span><span class="p">:</span> <span class="kt">Any</span><span class="o">...</span><span class="p">,</span> <span class="nv">combineOutput</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/RunOutput.html">RunOutput</a></span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>executable</em>
</code>
</td>
<td>
<div>
<p>path to an executable, or the name of an executable in PATH.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>args</em>
</code>
</td>
<td>
<div>
<p>the arguments, one string for each.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>combineOutput</em>
</code>
</td>
<td>
<div>
<p>if true then stdout and stderror go to the same stream. Default is false.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/runAsync"></a>
<a name="//apple_ref/swift/Section/runAsync" class="dashAnchor"></a>
<a href="#/runAsync">
<h3 class="section-name">runAsync</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/s:10SwiftShell14CommandRunningPAAE8runAsync__4file4lineAA0fC0CSS_ypdSSSitF"></a>
<a name="//apple_ref/swift/Method/runAsync(_:_:file:line:)" class="dashAnchor"></a>
<a class="token" href="#/s:10SwiftShell14CommandRunningPAAE8runAsync__4file4lineAA0fC0CSS_ypdSSSitF">runAsync(_:_:file:line:)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Runs executable and returns before it is finished.</p>
<div class="aside aside-warning">
<p class="aside-title">Warning</p>
Application will be terminated if executable could not be launched.
</div>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">runAsync</span><span class="p">(</span><span class="n">_</span> <span class="nv">executable</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="n">_</span> <span class="nv">args</span><span class="p">:</span> <span class="kt">Any</span><span class="o">...</span><span class="p">,</span> <span class="nv">file</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="kd">#file</span><span class="p">,</span> <span class="nv">line</span><span class="p">:</span> <span class="kt">Int</span> <span class="o">=</span> <span class="kd">#line</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/AsyncCommand.html">AsyncCommand</a></span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>executable</em>
</code>
</td>
<td>
<div>
<p>Path to an executable file. If not then exit.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>args</em>
</code>
</td>
<td>
<div>
<p>Arguments to the executable.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:10SwiftShell14CommandRunningPAAE16runAsyncAndPrint__4file4lineAA07PrintedfC0CSS_ypdSSSitF"></a>
<a name="//apple_ref/swift/Method/runAsyncAndPrint(_:_:file:line:)" class="dashAnchor"></a>
<a class="token" href="#/s:10SwiftShell14CommandRunningPAAE16runAsyncAndPrint__4file4lineAA07PrintedfC0CSS_ypdSSSitF">runAsyncAndPrint(_:_:file:line:)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Runs executable and returns before it is finished.
Any output is printed to standard output and standard error, respectively.</p>
<div class="aside aside-warning">
<p class="aside-title">Warning</p>
Application will be terminated if executable could not be launched.
</div>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">runAsyncAndPrint</span><span class="p">(</span><span class="n">_</span> <span class="nv">executable</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="n">_</span> <span class="nv">args</span><span class="p">:</span> <span class="kt">Any</span><span class="o">...</span><span class="p">,</span> <span class="nv">file</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="kd">#file</span><span class="p">,</span> <span class="nv">line</span><span class="p">:</span> <span class="kt">Int</span> <span class="o">=</span> <span class="kd">#line</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/PrintedAsyncCommand.html">PrintedAsyncCommand</a></span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>executable</em>
</code>
</td>
<td>
<div>
<p>Path to an executable file. If not then exit.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>args</em>
</code>
</td>
<td>
<div>
<p>Arguments to the executable.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/runAndPrint"></a>
<a name="//apple_ref/swift/Section/runAndPrint" class="dashAnchor"></a>
<a href="#/runAndPrint">
<h3 class="section-name">runAndPrint</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/s:10SwiftShell14CommandRunningPAAE11runAndPrintyySS_ypdtKF"></a>
<a name="//apple_ref/swift/Method/runAndPrint(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:10SwiftShell14CommandRunningPAAE11runAndPrintyySS_ypdtKF">runAndPrint(_:_:)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Runs executable and prints output and errors.</p>
<div class="aside aside-throws">
<p class="aside-title">Throws</p>
<p><code>CommandError.returnedErrorCode(command: String, errorcode: Int)</code> if the exit code is anything but 0.</p>
<p><code>CommandError.inAccessibleExecutable(path: String)</code> if &lsquo;executable turned out to be not so executable after all.</p>
</div>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">runAndPrint</span><span class="p">(</span><span class="n">_</span> <span class="nv">executable</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="n">_</span> <span class="nv">args</span><span class="p">:</span> <span class="kt">Any</span><span class="o">...</span><span class="p">)</span> <span class="k">throws</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>executable</em>
</code>
</td>
<td>
<div>
<p>path to an executable file.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>args</em>
</code>
</td>
<td>
<div>
<p>arguments to the executable.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external">kareman</a>. All rights reserved. (Last updated: 2019-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.5</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>