snoyman.com-content/static/typed-process/System-Process-Typed.html
2016-10-14 14:27:54 +03:00

63 lines
No EOL
60 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>System.Process.Typed</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_System-Process-Typed.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/System.Process.Typed.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">typed-process-0.1.0.0: Alternative API for processes, featuring more type safety</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">System.Process.Typed</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Types</a></li><li><a href="#g:2">ProcessConfig</a><ul><li><a href="#g:3">Smart constructors</a></li><li><a href="#g:4">Setters</a></li></ul></li><li><a href="#g:5">Stream specs</a></li><li><a href="#g:6">Launch a process</a></li><li><a href="#g:7">Interact with a process</a><ul><li><a href="#g:8">Process exit code</a></li><li><a href="#g:9">Process streams</a></li></ul></li><li><a href="#g:10">Exceptions</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Please see the README.md file for examples of using this API.</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr</li><li class="src short"><span class="keyword">data</span> <a href="#t:StreamSpec">StreamSpec</a> streamType a</li><li class="src short"><span class="keyword">data</span> <a href="#t:StreamType">StreamType</a><ul class="subs"><li>= <a href="#v:STInput">STInput</a></li><li>| <a href="#v:STOutput">STOutput</a></li></ul></li><li class="src short"><span class="keyword">data</span> <a href="#t:Process">Process</a> stdin stdout stderr</li><li class="src short"><a href="#v:proc">proc</a> :: <a href="../base-4.9.0.0/System-IO.html#t:FilePath">FilePath</a> -&gt; [<a href="../base-4.9.0.0/Data-String.html#t:String">String</a>] -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> () () ()</li><li class="src short"><a href="#v:shell">shell</a> :: <a href="../base-4.9.0.0/Data-String.html#t:String">String</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> () () ()</li><li class="src short"><a href="#v:setStdin">setStdin</a> :: <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> <a href="System-Process-Typed.html#v:STInput">STInput</a> stdin -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin0 stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr</li><li class="src short"><a href="#v:setStdout">setStdout</a> :: <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> <a href="System-Process-Typed.html#v:STOutput">STOutput</a> stdout -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout0 stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr</li><li class="src short"><a href="#v:setStderr">setStderr</a> :: <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> <a href="System-Process-Typed.html#v:STOutput">STOutput</a> stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr0 -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr</li><li class="src short"><a href="#v:setWorkingDir">setWorkingDir</a> :: <a href="../base-4.9.0.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr</li><li class="src short"><a href="#v:setEnv">setEnv</a> :: [(<a href="../base-4.9.0.0/Data-String.html#t:String">String</a>, <a href="../base-4.9.0.0/Data-String.html#t:String">String</a>)] -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr</li><li class="src short"><a href="#v:setCloseFds">setCloseFds</a> :: <a href="../base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr</li><li class="src short"><a href="#v:setCreateGroup">setCreateGroup</a> :: <a href="../base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr</li><li class="src short"><a href="#v:setDelegateCtlc">setDelegateCtlc</a> :: <a href="../base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr</li><li class="src short"><a href="#v:setDetachConsole">setDetachConsole</a> :: <a href="../base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr</li><li class="src short"><a href="#v:setCreateNewConsole">setCreateNewConsole</a> :: <a href="../base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr</li><li class="src short"><a href="#v:setNewSession">setNewSession</a> :: <a href="../base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr</li><li class="src short"><a href="#v:setChildGroup">setChildGroup</a> :: <a href="../base-4.9.0.0/System-Posix-Types.html#t:GroupID">GroupID</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr</li><li class="src short"><a href="#v:setChildUser">setChildUser</a> :: <a href="../base-4.9.0.0/System-Posix-Types.html#t:UserID">UserID</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr</li><li class="src short"><a href="#v:setCheckExitCode">setCheckExitCode</a> :: <a href="../base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr</li><li class="src short"><a href="#v:mkStreamSpec">mkStreamSpec</a> :: <a href="../process-1.4.2.0/System-Process.html#t:StdStream">StdStream</a> -&gt; (<a href="../base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="../base-4.9.0.0/GHC-IO-Handle.html#t:Handle">Handle</a> -&gt; <a href="../base-4.9.0.0/System-IO.html#t:IO">IO</a> (a, <a href="../base-4.9.0.0/System-IO.html#t:IO">IO</a> ())) -&gt; <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> streamType a</li><li class="src short"><a href="#v:inherit">inherit</a> :: <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> anyStreamType ()</li><li class="src short"><a href="#v:closed">closed</a> :: <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> anyStreamType ()</li><li class="src short"><a href="#v:byteStringInput">byteStringInput</a> :: <a href="../bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> <a href="System-Process-Typed.html#v:STInput">STInput</a> ()</li><li class="src short"><a href="#v:byteStringOutput">byteStringOutput</a> :: <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> <a href="System-Process-Typed.html#v:STOutput">STOutput</a> (<a href="../base-4.9.0.0/GHC-Conc.html#t:STM">STM</a> (<a href="../base-4.9.0.0/Data-Either.html#t:Either">Either</a> <a href="System-Process-Typed.html#t:ByteStringOutputException">ByteStringOutputException</a> <a href="../bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>))</li><li class="src short"><a href="#v:createPipe">createPipe</a> :: <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> anyStreamType <a href="../base-4.9.0.0/GHC-IO-Handle.html#t:Handle">Handle</a></li><li class="src short"><a href="#v:useHandleOpen">useHandleOpen</a> :: <a href="../base-4.9.0.0/GHC-IO-Handle.html#t:Handle">Handle</a> -&gt; <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> anyStreamType ()</li><li class="src short"><a href="#v:useHandleClose">useHandleClose</a> :: <a href="../base-4.9.0.0/GHC-IO-Handle.html#t:Handle">Handle</a> -&gt; <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> anyStreamType ()</li><li class="src short"><a href="#v:sink">sink</a> :: <a href="../base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> <a href="System-Process-Typed.html#v:STInput">STInput</a> (ConduitM <a href="../bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> o m ())</li><li class="src short"><a href="#v:source">source</a> :: <a href="../base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> <a href="System-Process-Typed.html#v:STOutput">STOutput</a> (ConduitM i <a href="../bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> m ())</li><li class="src short"><a href="#v:startProcess">startProcess</a> :: <a href="../base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; m (<a href="System-Process-Typed.html#t:Process">Process</a> stdin stdout stderr)</li><li class="src short"><a href="#v:stopProcess">stopProcess</a> :: <a href="../base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="System-Process-Typed.html#t:Process">Process</a> stdin stdout stderr -&gt; m ()</li><li class="src short"><a href="#v:withProcess">withProcess</a> :: (<a href="../base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, MonadMask m) =&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; (<a href="System-Process-Typed.html#t:Process">Process</a> stdin stdout stderr -&gt; m a) -&gt; m a</li><li class="src short"><a href="#v:readProcess">readProcess</a> :: <a href="../base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdoutIgnored stderrIgnored -&gt; m (<a href="../base-4.9.0.0/System-Exit.html#t:ExitCode">ExitCode</a>, <a href="../bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>, <a href="../bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>)</li><li class="src short"><a href="#v:runProcess">runProcess</a> :: <a href="../base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; m <a href="../base-4.9.0.0/System-Exit.html#t:ExitCode">ExitCode</a></li><li class="src short"><a href="#v:runProcess_">runProcess_</a> :: <a href="../base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; m ()</li><li class="src short"><a href="#v:waitExitCode">waitExitCode</a> :: <a href="../base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="System-Process-Typed.html#t:Process">Process</a> stdin stdout stderr -&gt; m <a href="../base-4.9.0.0/System-Exit.html#t:ExitCode">ExitCode</a></li><li class="src short"><a href="#v:waitExitCodeSTM">waitExitCodeSTM</a> :: <a href="System-Process-Typed.html#t:Process">Process</a> stdin stdout stderr -&gt; <a href="../base-4.9.0.0/GHC-Conc.html#t:STM">STM</a> <a href="../base-4.9.0.0/System-Exit.html#t:ExitCode">ExitCode</a></li><li class="src short"><a href="#v:checkExitCode">checkExitCode</a> :: <a href="../base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="System-Process-Typed.html#t:Process">Process</a> stdin stdout stderr -&gt; m (<a href="../base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="../base-4.9.0.0/System-Exit.html#t:ExitCode">ExitCode</a>)</li><li class="src short"><a href="#v:checkExitCodeSTM">checkExitCodeSTM</a> :: <a href="System-Process-Typed.html#t:Process">Process</a> stdin stdout stderr -&gt; <a href="../base-4.9.0.0/GHC-Conc.html#t:STM">STM</a> (<a href="../base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="../base-4.9.0.0/System-Exit.html#t:ExitCode">ExitCode</a>)</li><li class="src short"><a href="#v:getStdin">getStdin</a> :: <a href="System-Process-Typed.html#t:Process">Process</a> stdin stdout stderr -&gt; stdin</li><li class="src short"><a href="#v:getStdout">getStdout</a> :: <a href="System-Process-Typed.html#t:Process">Process</a> stdin stdout stderr -&gt; stdout</li><li class="src short"><a href="#v:getStderr">getStderr</a> :: <a href="System-Process-Typed.html#t:Process">Process</a> stdin stdout stderr -&gt; stderr</li><li class="src short"><span class="keyword">data</span> <a href="#t:ExitCodeException">ExitCodeException</a> = <a href="#v:ExitCodeException">ExitCodeException</a> <a href="../base-4.9.0.0/System-Exit.html#t:ExitCode">ExitCode</a> (<a href="../base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="../base-4.9.0.0/Control-Exception-Base.html#t:SomeException">SomeException</a>)</li><li class="src short"><span class="keyword">newtype</span> <a href="#t:ByteStringOutputException">ByteStringOutputException</a> = <a href="#v:ByteStringOutputException">ByteStringOutputException</a> <a href="../base-4.9.0.0/Control-Exception-Base.html#t:SomeException">SomeException</a></li></ul></div><div id="interface"><h1 id="g:1">Types</h1><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:ProcessConfig" class="def">ProcessConfig</a> stdin stdout stderr <a href="src/System.Process.Typed.html#ProcessConfig" class="link">Source</a> <a href="#t:ProcessConfig" class="selflink">#</a></p><div class="doc"><p>An abstract configuration for a process, which can then be
launched into an actual running <code><a href="System-Process-Typed.html#t:Process">Process</a></code>. Takes three type
parameters, providing the types of standard input, standard output,
and standard error, respectively.</p><p>There are three ways to construct a value of this type:</p><ul><li>With the <code><a href="System-Process-Typed.html#v:proc">proc</a></code> smart constructor, which takes a command name and
a list of arguments.</li><li>With the <code><a href="System-Process-Typed.html#v:shell">shell</a></code> smart constructor, which takes a shell string</li><li>With the <code><a href="../base-4.9.0.0/Data-String.html#t:IsString">IsString</a></code> instance via OverloadedStrings. If you
provide it a string with no spaces (e.g., <code>&quot;date&quot;</code>), it will
treat it as a raw command with no arguments (e.g., <code>proc &quot;date&quot;
[]</code>). If it has spaces, it will use <code>shell</code>.</li></ul><p>In all cases, the default for all three streams is to inherit the
streams from the parent process. For other settings, see the
setters below for default values.</p><p><em>Since: 0.1.0.0</em></p></div><div class="subs instances"><p id="control.i:ProcessConfig" class="caption collapser" onclick="toggleSection('i:ProcessConfig')">Instances</p><div id="section.i:ProcessConfig" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:ProcessConfig:IsString:1" class="instance expander" onclick="toggleSection('i:id:ProcessConfig:IsString:1')"></span> ((~) <a href="../base-4.9.0.0/Data-Kind.html#t:-42-">*</a> stdin (), (~) <a href="../base-4.9.0.0/Data-Kind.html#t:-42-">*</a> stdout (), (~) <a href="../base-4.9.0.0/Data-Kind.html#t:-42-">*</a> stderr ()) =&gt; <a href="../base-4.9.0.0/Data-String.html#t:IsString">IsString</a> (<a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr)</span> <a href="src/System.Process.Typed.html#line-147" class="link">Source</a> <a href="#t:ProcessConfig" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:ProcessConfig:IsString:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fromString">fromString</a> :: <a href="../base-4.9.0.0/Data-String.html#t:String">String</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr <a href="#v:fromString" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:StreamSpec" class="def">StreamSpec</a> streamType a <a href="src/System.Process.Typed.html#StreamSpec" class="link">Source</a> <a href="#t:StreamSpec" class="selflink">#</a></p><div class="doc"><p>A specification for how to create one of the three standard child
streams. See examples below.</p><p><em>Since: 0.1.0.0</em></p></div><div class="subs instances"><p id="control.i:StreamSpec" class="caption collapser" onclick="toggleSection('i:StreamSpec')">Instances</p><div id="section.i:StreamSpec" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:StreamSpec:Functor:1" class="instance expander" onclick="toggleSection('i:id:StreamSpec:Functor:1')"></span> <a href="../base-4.9.0.0/Data-Functor.html#t:Functor">Functor</a> (<a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> streamType)</span> <a href="src/System.Process.Typed.html#line-169" class="link">Source</a> <a href="#t:StreamSpec" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:StreamSpec:Functor:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fmap">fmap</a> :: (a -&gt; b) -&gt; <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> streamType a -&gt; <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> streamType b <a href="#v:fmap" class="selflink">#</a></p><p class="src"><a href="#v:-60--36-">(&lt;$)</a> :: a -&gt; <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> streamType b -&gt; <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> streamType a <a href="#v:-60--36-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:StreamSpec:IsString:2" class="instance expander" onclick="toggleSection('i:id:StreamSpec:IsString:2')"></span> ((~) <a href="System-Process-Typed.html#t:StreamType">StreamType</a> streamType <a href="System-Process-Typed.html#v:STInput">STInput</a>, (~) <a href="../base-4.9.0.0/Data-Kind.html#t:-42-">*</a> res ()) =&gt; <a href="../base-4.9.0.0/Data-String.html#t:IsString">IsString</a> (<a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> streamType res)</span> <a href="src/System.Process.Typed.html#line-175" class="link">Source</a> <a href="#t:StreamSpec" class="selflink">#</a></td><td class="doc"><p>This instance uses <code><a href="System-Process-Typed.html#v:byteStringInput">byteStringInput</a></code> to convert a raw string into
a stream of input for a child process.</p><p><em>Since: 0.1.0.0</em></p></td></tr><tr><td colspan="2"><div id="section.i:id:StreamSpec:IsString:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fromString">fromString</a> :: <a href="../base-4.9.0.0/Data-String.html#t:String">String</a> -&gt; <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> streamType res <a href="#v:fromString" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:StreamType" class="def">StreamType</a> <a href="src/System.Process.Typed.html#StreamType" class="link">Source</a> <a href="#t:StreamType" class="selflink">#</a></p><div class="doc"><p>Whether a stream is an input stream or output stream. Note that
this is from the perspective of the <em>child process</em>, so that a
child's standard input stream is an <code>STInput</code>, even though the
parent process will be writing to it.</p><p><em>Since: 0.1.0.0</em></p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:STInput" class="def">STInput</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a id="v:STOutput" class="def">STOutput</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:Process" class="def">Process</a> stdin stdout stderr <a href="src/System.Process.Typed.html#Process" class="link">Source</a> <a href="#t:Process" class="selflink">#</a></p><div class="doc"><p>A running process. The three type parameters provide the type of
the standard input, standard output, and standard error streams.</p><p><em>Since: 0.1.0.0</em></p></div></div><h1 id="g:2">ProcessConfig</h1><h2 id="g:3">Smart constructors</h2><div class="top"><p class="src"><a id="v:proc" class="def">proc</a> :: <a href="../base-4.9.0.0/System-IO.html#t:FilePath">FilePath</a> -&gt; [<a href="../base-4.9.0.0/Data-String.html#t:String">String</a>] -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> () () () <a href="src/System.Process.Typed.html#proc" class="link">Source</a> <a href="#v:proc" class="selflink">#</a></p><div class="doc"><p>Create a <code><a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a></code> from the given command and arguments.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:shell" class="def">shell</a> :: <a href="../base-4.9.0.0/Data-String.html#t:String">String</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> () () () <a href="src/System.Process.Typed.html#shell" class="link">Source</a> <a href="#v:shell" class="selflink">#</a></p><div class="doc"><p>Create a <code><a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a></code> from the given shell command.</p><p><em>Since: 0.1.0.0</em></p></div></div><h2 id="g:4">Setters</h2><div class="top"><p class="src"><a id="v:setStdin" class="def">setStdin</a> :: <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> <a href="System-Process-Typed.html#v:STInput">STInput</a> stdin -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin0 stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr <a href="src/System.Process.Typed.html#setStdin" class="link">Source</a> <a href="#v:setStdin" class="selflink">#</a></p><div class="doc"><p>Set the child's standard input stream to the given <code><a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a></code>.</p><p>Default: <code><a href="System-Process-Typed.html#v:inherit">inherit</a></code></p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:setStdout" class="def">setStdout</a> :: <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> <a href="System-Process-Typed.html#v:STOutput">STOutput</a> stdout -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout0 stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr <a href="src/System.Process.Typed.html#setStdout" class="link">Source</a> <a href="#v:setStdout" class="selflink">#</a></p><div class="doc"><p>Set the child's standard output stream to the given <code><a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a></code>.</p><p>Default: <code><a href="System-Process-Typed.html#v:inherit">inherit</a></code></p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:setStderr" class="def">setStderr</a> :: <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> <a href="System-Process-Typed.html#v:STOutput">STOutput</a> stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr0 -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr <a href="src/System.Process.Typed.html#setStderr" class="link">Source</a> <a href="#v:setStderr" class="selflink">#</a></p><div class="doc"><p>Set the child's standard error stream to the given <code><a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a></code>.</p><p>Default: <code><a href="System-Process-Typed.html#v:inherit">inherit</a></code></p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:setWorkingDir" class="def">setWorkingDir</a> :: <a href="../base-4.9.0.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr <a href="src/System.Process.Typed.html#setWorkingDir" class="link">Source</a> <a href="#v:setWorkingDir" class="selflink">#</a></p><div class="doc"><p>Set the working directory of the child process.</p><p>Default: current process's working directory.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:setEnv" class="def">setEnv</a> :: [(<a href="../base-4.9.0.0/Data-String.html#t:String">String</a>, <a href="../base-4.9.0.0/Data-String.html#t:String">String</a>)] -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr <a href="src/System.Process.Typed.html#setEnv" class="link">Source</a> <a href="#v:setEnv" class="selflink">#</a></p><div class="doc"><p>Set the environment variables of the child process.</p><p>Default: current process's environment.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:setCloseFds" class="def">setCloseFds</a> :: <a href="../base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr <a href="src/System.Process.Typed.html#setCloseFds" class="link">Source</a> <a href="#v:setCloseFds" class="selflink">#</a></p><div class="doc"><p>Should we close all file descriptors besides stdin, stdout, and
stderr? See <code><a href="../process-1.4.2.0/System-Process.html#v:close_fds">close_fds</a></code> for more information.</p><p>Default: False</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:setCreateGroup" class="def">setCreateGroup</a> :: <a href="../base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr <a href="src/System.Process.Typed.html#setCreateGroup" class="link">Source</a> <a href="#v:setCreateGroup" class="selflink">#</a></p><div class="doc"><p>Should we create a new process group?</p><p>Default: False</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:setDelegateCtlc" class="def">setDelegateCtlc</a> :: <a href="../base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr <a href="src/System.Process.Typed.html#setDelegateCtlc" class="link">Source</a> <a href="#v:setDelegateCtlc" class="selflink">#</a></p><div class="doc"><p>Delegate handling of Ctrl-C to the child. For more information,
see <code><a href="../process-1.4.2.0/System-Process.html#v:delegate_ctlc">delegate_ctlc</a></code>.</p><p>Default: False</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:setDetachConsole" class="def">setDetachConsole</a> :: <a href="../base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr <a href="src/System.Process.Typed.html#setDetachConsole" class="link">Source</a> <a href="#v:setDetachConsole" class="selflink">#</a></p><div class="doc"><p>Detach console on Windows, see <code><a href="../process-1.4.2.0/System-Process.html#v:detach_console">detach_console</a></code>.</p><p>Default: False</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:setCreateNewConsole" class="def">setCreateNewConsole</a> :: <a href="../base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr <a href="src/System.Process.Typed.html#setCreateNewConsole" class="link">Source</a> <a href="#v:setCreateNewConsole" class="selflink">#</a></p><div class="doc"><p>Create new console on Windows, see <code><a href="../process-1.4.2.0/System-Process.html#v:create_new_console">create_new_console</a></code>.</p><p>Default: False</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:setNewSession" class="def">setNewSession</a> :: <a href="../base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr <a href="src/System.Process.Typed.html#setNewSession" class="link">Source</a> <a href="#v:setNewSession" class="selflink">#</a></p><div class="doc"><p>Set a new session with the POSIX <code>setsid</code> syscall, does nothing
on non-POSIX. See <code><a href="../process-1.4.2.0/System-Process.html#v:new_session">new_session</a></code>.</p><p>Default: False</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:setChildGroup" class="def">setChildGroup</a> :: <a href="../base-4.9.0.0/System-Posix-Types.html#t:GroupID">GroupID</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr <a href="src/System.Process.Typed.html#setChildGroup" class="link">Source</a> <a href="#v:setChildGroup" class="selflink">#</a></p><div class="doc"><p>Set the child process's group ID with the POSIX <code>setgid</code> syscall,
does nothing on non-POSIX. See <code><a href="../process-1.4.2.0/System-Process.html#v:child_group">child_group</a></code>.</p><p>Default: False</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:setChildUser" class="def">setChildUser</a> :: <a href="../base-4.9.0.0/System-Posix-Types.html#t:UserID">UserID</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr <a href="src/System.Process.Typed.html#setChildUser" class="link">Source</a> <a href="#v:setChildUser" class="selflink">#</a></p><div class="doc"><p>Set the child process's user ID with the POSIX <code>setuid</code> syscall,
does nothing on non-POSIX. See <code><a href="../process-1.4.2.0/System-Process.html#v:child_user">child_user</a></code>.</p><p>Default: False</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:setCheckExitCode" class="def">setCheckExitCode</a> :: <a href="../base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr <a href="src/System.Process.Typed.html#setCheckExitCode" class="link">Source</a> <a href="#v:setCheckExitCode" class="selflink">#</a></p><div class="doc"><p>Should we throw an exception when the process exits with a
non-success code?</p><p>If set to <code><a href="../base-4.9.0.0/Data-Bool.html#v:True">True</a></code>, then when <code><a href="System-Process-Typed.html#v:stopProcess">stopProcess</a></code> is called - either
directly or via <code><a href="System-Process-Typed.html#v:withProcess">withProcess</a></code> or other wrappers - the processes
exit code will be checked. Any exit code besides <code><a href="../base-4.9.0.0/System-Exit.html#v:ExitSuccess">ExitSuccess</a></code> will
result in an <code><a href="System-Process-Typed.html#t:ExitCodeException">ExitCodeException</a></code> being thrown.</p><p>Default: <code><a href="../base-4.9.0.0/Data-Bool.html#v:False">False</a></code></p><p><em>Since: 0.1.0.0</em></p></div></div><h1 id="g:5">Stream specs</h1><div class="top"><p class="src"><a id="v:mkStreamSpec" class="def">mkStreamSpec</a> :: <a href="../process-1.4.2.0/System-Process.html#t:StdStream">StdStream</a> -&gt; (<a href="../base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="../base-4.9.0.0/GHC-IO-Handle.html#t:Handle">Handle</a> -&gt; <a href="../base-4.9.0.0/System-IO.html#t:IO">IO</a> (a, <a href="../base-4.9.0.0/System-IO.html#t:IO">IO</a> ())) -&gt; <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> streamType a <a href="src/System.Process.Typed.html#mkStreamSpec" class="link">Source</a> <a href="#v:mkStreamSpec" class="selflink">#</a></p><div class="doc"><p>Create a new <code><a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a></code> from the given <code><a href="../process-1.4.2.0/System-Process.html#t:StdStream">StdStream</a></code> and a
helper function. This function:</p><ul><li>Takes as input the raw <code>Maybe Handle</code> returned by the
<code><a href="../process-1.4.2.0/System-Process.html#v:createProcess">createProcess</a></code> function. This will be determined by the
<code><a href="../process-1.4.2.0/System-Process.html#t:StdStream">StdStream</a></code> argument.</li><li>Returns the actual stream value <code>a</code>, as well as a cleanup</li><li>function to be run when calling <code><a href="System-Process-Typed.html#v:stopProcess">stopProcess</a></code>.</li></ul><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:inherit" class="def">inherit</a> :: <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> anyStreamType () <a href="src/System.Process.Typed.html#inherit" class="link">Source</a> <a href="#v:inherit" class="selflink">#</a></p><div class="doc"><p>A stream spec which simply inherits the stream of the parent
process.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:closed" class="def">closed</a> :: <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> anyStreamType () <a href="src/System.Process.Typed.html#closed" class="link">Source</a> <a href="#v:closed" class="selflink">#</a></p><div class="doc"><p>A stream spec which will close the stream for the child process.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:byteStringInput" class="def">byteStringInput</a> :: <a href="../bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> <a href="System-Process-Typed.html#v:STInput">STInput</a> () <a href="src/System.Process.Typed.html#byteStringInput" class="link">Source</a> <a href="#v:byteStringInput" class="selflink">#</a></p><div class="doc"><p>An input stream spec which sets the input to the given
<code><a href="../bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></code>. A separate thread will be forked to write the
contents to the child process.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:byteStringOutput" class="def">byteStringOutput</a> :: <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> <a href="System-Process-Typed.html#v:STOutput">STOutput</a> (<a href="../base-4.9.0.0/GHC-Conc.html#t:STM">STM</a> (<a href="../base-4.9.0.0/Data-Either.html#t:Either">Either</a> <a href="System-Process-Typed.html#t:ByteStringOutputException">ByteStringOutputException</a> <a href="../bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>)) <a href="src/System.Process.Typed.html#byteStringOutput" class="link">Source</a> <a href="#v:byteStringOutput" class="selflink">#</a></p><div class="doc"><p>Capture the output of a process in a <code><a href="../bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></code>.</p><p>This function will fork a separate thread to consume all input from
the process, and will only make the results available when the
underlying <code><a href="../base-4.9.0.0/GHC-IO-Handle.html#t:Handle">Handle</a></code> is closed. As this is provided as an <code><a href="../base-4.9.0.0/GHC-Conc.html#t:STM">STM</a></code>
action, you can either check if the result is available, or block
until it's ready.</p><p>In the event of any exception occurring when reading from the
<code><a href="../base-4.9.0.0/GHC-IO-Handle.html#t:Handle">Handle</a></code>, the result of this function will be a <code><a href="../base-4.9.0.0/Data-Either.html#v:Left">Left</a></code> value
containing a <code><a href="System-Process-Typed.html#t:ByteStringOutputException">ByteStringOutputException</a></code>.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:createPipe" class="def">createPipe</a> :: <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> anyStreamType <a href="../base-4.9.0.0/GHC-IO-Handle.html#t:Handle">Handle</a> <a href="src/System.Process.Typed.html#createPipe" class="link">Source</a> <a href="#v:createPipe" class="selflink">#</a></p><div class="doc"><p>Create a new pipe between this process and the child, and return
a <code><a href="../base-4.9.0.0/GHC-IO-Handle.html#t:Handle">Handle</a></code> to communicate with the child.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:useHandleOpen" class="def">useHandleOpen</a> :: <a href="../base-4.9.0.0/GHC-IO-Handle.html#t:Handle">Handle</a> -&gt; <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> anyStreamType () <a href="src/System.Process.Typed.html#useHandleOpen" class="link">Source</a> <a href="#v:useHandleOpen" class="selflink">#</a></p><div class="doc"><p>Use the provided <code><a href="../base-4.9.0.0/GHC-IO-Handle.html#t:Handle">Handle</a></code> for the child process, and when the
process exits, do <em>not</em> close it. This is useful if, for example,
you want to have multiple processes write to the same log file
sequentially.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:useHandleClose" class="def">useHandleClose</a> :: <a href="../base-4.9.0.0/GHC-IO-Handle.html#t:Handle">Handle</a> -&gt; <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> anyStreamType () <a href="src/System.Process.Typed.html#useHandleClose" class="link">Source</a> <a href="#v:useHandleClose" class="selflink">#</a></p><div class="doc"><p>Use the provided <code><a href="../base-4.9.0.0/GHC-IO-Handle.html#t:Handle">Handle</a></code> for the child process, and when the
process exits, close it. If you have no reason to keep the <code><a href="../base-4.9.0.0/GHC-IO-Handle.html#t:Handle">Handle</a></code>
open, you should use this over <code><a href="System-Process-Typed.html#v:useHandleOpen">useHandleOpen</a></code>.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:sink" class="def">sink</a> :: <a href="../base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> <a href="System-Process-Typed.html#v:STInput">STInput</a> (ConduitM <a href="../bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> o m ()) <a href="src/System.Process.Typed.html#sink" class="link">Source</a> <a href="#v:sink" class="selflink">#</a></p><div class="doc"><p>Provide input to a process by writing to a conduit.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:source" class="def">source</a> :: <a href="../base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="System-Process-Typed.html#t:StreamSpec">StreamSpec</a> <a href="System-Process-Typed.html#v:STOutput">STOutput</a> (ConduitM i <a href="../bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> m ()) <a href="src/System.Process.Typed.html#source" class="link">Source</a> <a href="#v:source" class="selflink">#</a></p><div class="doc"><p>Read output from a process by read from a conduit.</p><p><em>Since: 0.1.0.0</em></p></div></div><h1 id="g:6">Launch a process</h1><div class="top"><p class="src"><a id="v:startProcess" class="def">startProcess</a> :: <a href="../base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; m (<a href="System-Process-Typed.html#t:Process">Process</a> stdin stdout stderr) <a href="src/System.Process.Typed.html#startProcess" class="link">Source</a> <a href="#v:startProcess" class="selflink">#</a></p><div class="doc"><p>Launch a process based on the given <code><a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a></code>. You should
ensure that you close <code><a href="System-Process-Typed.html#v:stopProcess">stopProcess</a></code> on the result. It's usually
better to use one of the functions in this module which ensures
<code><a href="System-Process-Typed.html#v:stopProcess">stopProcess</a></code> is called, such as <code><a href="System-Process-Typed.html#v:withProcess">withProcess</a></code>.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:stopProcess" class="def">stopProcess</a> :: <a href="../base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="System-Process-Typed.html#t:Process">Process</a> stdin stdout stderr -&gt; m () <a href="src/System.Process.Typed.html#stopProcess" class="link">Source</a> <a href="#v:stopProcess" class="selflink">#</a></p><div class="doc"><p>Close a process and release any resources acquired. This will
ensure <code><a href="../process-1.4.2.0/System-Process.html#v:terminateProcess">terminateProcess</a></code> is called, wait for the process to
actually exit, and then close out resources allocated for the
streams. In the event of any cleanup exceptions being thrown, or if
a non-success exit code was received and <code><a href="System-Process-Typed.html#v:setCheckExitCode">setCheckExitCode</a></code> was
used, this will throw an exception.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:withProcess" class="def">withProcess</a> :: (<a href="../base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, MonadMask m) =&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; (<a href="System-Process-Typed.html#t:Process">Process</a> stdin stdout stderr -&gt; m a) -&gt; m a <a href="src/System.Process.Typed.html#withProcess" class="link">Source</a> <a href="#v:withProcess" class="selflink">#</a></p><div class="doc"><p>Use the bracket pattern to call <code><a href="System-Process-Typed.html#v:startProcess">startProcess</a></code> and ensure
<code><a href="System-Process-Typed.html#v:stopProcess">stopProcess</a></code> is called.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:readProcess" class="def">readProcess</a> :: <a href="../base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdoutIgnored stderrIgnored -&gt; m (<a href="../base-4.9.0.0/System-Exit.html#t:ExitCode">ExitCode</a>, <a href="../bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>, <a href="../bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>) <a href="src/System.Process.Typed.html#readProcess" class="link">Source</a> <a href="#v:readProcess" class="selflink">#</a></p><div class="doc"><p>Run a process, capture its standard output and error as a
<code><a href="../bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></code>, wait for it to complete, and then return its exit
code, output, and error.</p><p>Note that any previously used <code><a href="System-Process-Typed.html#v:setStdout">setStdout</a></code> or <code><a href="System-Process-Typed.html#v:setStderr">setStderr</a></code> will be
overridden.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:runProcess" class="def">runProcess</a> :: <a href="../base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; m <a href="../base-4.9.0.0/System-Exit.html#t:ExitCode">ExitCode</a> <a href="src/System.Process.Typed.html#runProcess" class="link">Source</a> <a href="#v:runProcess" class="selflink">#</a></p><div class="doc"><p>Run the given process, wait for it to exit, and returns its
<code><a href="../base-4.9.0.0/System-Exit.html#t:ExitCode">ExitCode</a></code>.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:runProcess_" class="def">runProcess_</a> :: <a href="../base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="System-Process-Typed.html#t:ProcessConfig">ProcessConfig</a> stdin stdout stderr -&gt; m () <a href="src/System.Process.Typed.html#runProcess_" class="link">Source</a> <a href="#v:runProcess_" class="selflink">#</a></p><div class="doc"><p>Same as <code><a href="System-Process-Typed.html#v:runProcess">runProcess</a></code>, but ignores the <code><a href="../base-4.9.0.0/System-Exit.html#t:ExitCode">ExitCode</a></code>.</p><p><em>Since: 0.1.0.0</em></p></div></div><h1 id="g:7">Interact with a process</h1><h2 id="g:8">Process exit code</h2><div class="top"><p class="src"><a id="v:waitExitCode" class="def">waitExitCode</a> :: <a href="../base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="System-Process-Typed.html#t:Process">Process</a> stdin stdout stderr -&gt; m <a href="../base-4.9.0.0/System-Exit.html#t:ExitCode">ExitCode</a> <a href="src/System.Process.Typed.html#waitExitCode" class="link">Source</a> <a href="#v:waitExitCode" class="selflink">#</a></p><div class="doc"><p>Wait for the process to exit and then return its <code><a href="../base-4.9.0.0/System-Exit.html#t:ExitCode">ExitCode</a></code>.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:waitExitCodeSTM" class="def">waitExitCodeSTM</a> :: <a href="System-Process-Typed.html#t:Process">Process</a> stdin stdout stderr -&gt; <a href="../base-4.9.0.0/GHC-Conc.html#t:STM">STM</a> <a href="../base-4.9.0.0/System-Exit.html#t:ExitCode">ExitCode</a> <a href="src/System.Process.Typed.html#waitExitCodeSTM" class="link">Source</a> <a href="#v:waitExitCodeSTM" class="selflink">#</a></p><div class="doc"><p>Same as <code><a href="System-Process-Typed.html#v:waitExitCode">waitExitCode</a></code>, but in <code><a href="../base-4.9.0.0/GHC-Conc.html#t:STM">STM</a></code>.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:checkExitCode" class="def">checkExitCode</a> :: <a href="../base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="System-Process-Typed.html#t:Process">Process</a> stdin stdout stderr -&gt; m (<a href="../base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="../base-4.9.0.0/System-Exit.html#t:ExitCode">ExitCode</a>) <a href="src/System.Process.Typed.html#checkExitCode" class="link">Source</a> <a href="#v:checkExitCode" class="selflink">#</a></p><div class="doc"><p>Check if a process has exited and, if so, return its <code><a href="../base-4.9.0.0/System-Exit.html#t:ExitCode">ExitCode</a></code>.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:checkExitCodeSTM" class="def">checkExitCodeSTM</a> :: <a href="System-Process-Typed.html#t:Process">Process</a> stdin stdout stderr -&gt; <a href="../base-4.9.0.0/GHC-Conc.html#t:STM">STM</a> (<a href="../base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="../base-4.9.0.0/System-Exit.html#t:ExitCode">ExitCode</a>) <a href="src/System.Process.Typed.html#checkExitCodeSTM" class="link">Source</a> <a href="#v:checkExitCodeSTM" class="selflink">#</a></p><div class="doc"><p>Same as <code><a href="System-Process-Typed.html#v:checkExitCode">checkExitCode</a></code>, but in <code><a href="../base-4.9.0.0/GHC-Conc.html#t:STM">STM</a></code>.</p><p><em>Since: 0.1.0.0</em></p></div></div><h2 id="g:9">Process streams</h2><div class="top"><p class="src"><a id="v:getStdin" class="def">getStdin</a> :: <a href="System-Process-Typed.html#t:Process">Process</a> stdin stdout stderr -&gt; stdin <a href="src/System.Process.Typed.html#getStdin" class="link">Source</a> <a href="#v:getStdin" class="selflink">#</a></p><div class="doc"><p>Get the child's standard input stream value.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:getStdout" class="def">getStdout</a> :: <a href="System-Process-Typed.html#t:Process">Process</a> stdin stdout stderr -&gt; stdout <a href="src/System.Process.Typed.html#getStdout" class="link">Source</a> <a href="#v:getStdout" class="selflink">#</a></p><div class="doc"><p>Get the child's standard output stream value.</p><p><em>Since: 0.1.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:getStderr" class="def">getStderr</a> :: <a href="System-Process-Typed.html#t:Process">Process</a> stdin stdout stderr -&gt; stderr <a href="src/System.Process.Typed.html#getStderr" class="link">Source</a> <a href="#v:getStderr" class="selflink">#</a></p><div class="doc"><p>Get the child's standard error stream value.</p><p><em>Since: 0.1.0.0</em></p></div></div><h1 id="g:10">Exceptions</h1><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:ExitCodeException" class="def">ExitCodeException</a> <a href="src/System.Process.Typed.html#ExitCodeException" class="link">Source</a> <a href="#t:ExitCodeException" class="selflink">#</a></p><div class="doc"><p>Exit code generated by <code><a href="System-Process-Typed.html#v:stopProcess">stopProcess</a></code> when <code><a href="System-Process-Typed.html#v:setCheckExitCode">setCheckExitCode</a></code> is
<code><a href="../base-4.9.0.0/Data-Bool.html#v:True">True</a></code> and a process exits with a non-success code. Contains the
non-success code, and if any other exceptions occur during cleanup,
that exception.</p><p><em>Since: 0.1.0.0</em></p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:ExitCodeException" class="def">ExitCodeException</a> <a href="../base-4.9.0.0/System-Exit.html#t:ExitCode">ExitCode</a> (<a href="../base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="../base-4.9.0.0/Control-Exception-Base.html#t:SomeException">SomeException</a>)</td><td class="doc empty">&nbsp;</td></tr></table></div><div class="subs instances"><p id="control.i:ExitCodeException" class="caption collapser" onclick="toggleSection('i:ExitCodeException')">Instances</p><div id="section.i:ExitCodeException" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:ExitCodeException:Show:1" class="instance expander" onclick="toggleSection('i:id:ExitCodeException:Show:1')"></span> <a href="../base-4.9.0.0/Text-Show.html#t:Show">Show</a> <a href="System-Process-Typed.html#t:ExitCodeException">ExitCodeException</a></span> <a href="src/System.Process.Typed.html#line-723" class="link">Source</a> <a href="#t:ExitCodeException" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:ExitCodeException:Show:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:showsPrec">showsPrec</a> :: <a href="../base-4.9.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="System-Process-Typed.html#t:ExitCodeException">ExitCodeException</a> -&gt; <a href="../base-4.9.0.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showsPrec" class="selflink">#</a></p><p class="src"><a href="#v:show">show</a> :: <a href="System-Process-Typed.html#t:ExitCodeException">ExitCodeException</a> -&gt; <a href="../base-4.9.0.0/Data-String.html#t:String">String</a> <a href="#v:show" class="selflink">#</a></p><p class="src"><a href="#v:showList">showList</a> :: [<a href="System-Process-Typed.html#t:ExitCodeException">ExitCodeException</a>] -&gt; <a href="../base-4.9.0.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showList" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:ExitCodeException:Exception:2" class="instance expander" onclick="toggleSection('i:id:ExitCodeException:Exception:2')"></span> <a href="../base-4.9.0.0/Control-Exception-Base.html#t:Exception">Exception</a> <a href="System-Process-Typed.html#t:ExitCodeException">ExitCodeException</a></span> <a href="src/System.Process.Typed.html#line-724" class="link">Source</a> <a href="#t:ExitCodeException" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:ExitCodeException:Exception:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toException">toException</a> :: <a href="System-Process-Typed.html#t:ExitCodeException">ExitCodeException</a> -&gt; <a href="../base-4.9.0.0/Control-Exception-Base.html#t:SomeException">SomeException</a> <a href="#v:toException" class="selflink">#</a></p><p class="src"><a href="#v:fromException">fromException</a> :: <a href="../base-4.9.0.0/Control-Exception-Base.html#t:SomeException">SomeException</a> -&gt; <a href="../base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="System-Process-Typed.html#t:ExitCodeException">ExitCodeException</a> <a href="#v:fromException" class="selflink">#</a></p><p class="src"><a href="#v:displayException">displayException</a> :: <a href="System-Process-Typed.html#t:ExitCodeException">ExitCodeException</a> -&gt; <a href="../base-4.9.0.0/Data-String.html#t:String">String</a> <a href="#v:displayException" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">newtype</span> <a id="t:ByteStringOutputException" class="def">ByteStringOutputException</a> <a href="src/System.Process.Typed.html#ByteStringOutputException" class="link">Source</a> <a href="#t:ByteStringOutputException" class="selflink">#</a></p><div class="doc"><p>Wrapper for when an exception is thrown when reading from a child
process, used by <code><a href="System-Process-Typed.html#v:byteStringOutput">byteStringOutput</a></code>.</p><p><em>Since: 0.1.0.0</em></p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:ByteStringOutputException" class="def">ByteStringOutputException</a> <a href="../base-4.9.0.0/Control-Exception-Base.html#t:SomeException">SomeException</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="subs instances"><p id="control.i:ByteStringOutputException" class="caption collapser" onclick="toggleSection('i:ByteStringOutputException')">Instances</p><div id="section.i:ByteStringOutputException" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:ByteStringOutputException:Show:1" class="instance expander" onclick="toggleSection('i:id:ByteStringOutputException:Show:1')"></span> <a href="../base-4.9.0.0/Text-Show.html#t:Show">Show</a> <a href="System-Process-Typed.html#t:ByteStringOutputException">ByteStringOutputException</a></span> <a href="src/System.Process.Typed.html#line-731" class="link">Source</a> <a href="#t:ByteStringOutputException" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:ByteStringOutputException:Show:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:showsPrec">showsPrec</a> :: <a href="../base-4.9.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="System-Process-Typed.html#t:ByteStringOutputException">ByteStringOutputException</a> -&gt; <a href="../base-4.9.0.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showsPrec" class="selflink">#</a></p><p class="src"><a href="#v:show">show</a> :: <a href="System-Process-Typed.html#t:ByteStringOutputException">ByteStringOutputException</a> -&gt; <a href="../base-4.9.0.0/Data-String.html#t:String">String</a> <a href="#v:show" class="selflink">#</a></p><p class="src"><a href="#v:showList">showList</a> :: [<a href="System-Process-Typed.html#t:ByteStringOutputException">ByteStringOutputException</a>] -&gt; <a href="../base-4.9.0.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showList" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:ByteStringOutputException:Exception:2" class="instance expander" onclick="toggleSection('i:id:ByteStringOutputException:Exception:2')"></span> <a href="../base-4.9.0.0/Control-Exception-Base.html#t:Exception">Exception</a> <a href="System-Process-Typed.html#t:ByteStringOutputException">ByteStringOutputException</a></span> <a href="src/System.Process.Typed.html#line-732" class="link">Source</a> <a href="#t:ByteStringOutputException" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:ByteStringOutputException:Exception:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toException">toException</a> :: <a href="System-Process-Typed.html#t:ByteStringOutputException">ByteStringOutputException</a> -&gt; <a href="../base-4.9.0.0/Control-Exception-Base.html#t:SomeException">SomeException</a> <a href="#v:toException" class="selflink">#</a></p><p class="src"><a href="#v:fromException">fromException</a> :: <a href="../base-4.9.0.0/Control-Exception-Base.html#t:SomeException">SomeException</a> -&gt; <a href="../base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="System-Process-Typed.html#t:ByteStringOutputException">ByteStringOutputException</a> <a href="#v:fromException" class="selflink">#</a></p><p class="src"><a href="#v:displayException">displayException</a> :: <a href="System-Process-Typed.html#t:ByteStringOutputException">ByteStringOutputException</a> -&gt; <a href="../base-4.9.0.0/Data-String.html#t:String">String</a> <a href="#v:displayException" class="selflink">#</a></p></div></div></td></tr></table></div></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.2</p></div></body></html>