Skip to content

Commit 12f95f5

Browse files
committed
Add toStandardError
1 parent 174a082 commit 12f95f5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Node/ChildProcess.purs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module Node.ChildProcess
1111
, send
1212
, disconnect
1313
, Error()
14+
, toStandardError
1415
, Exit(..)
1516
, onExit
1617
, onClose
@@ -32,6 +33,7 @@ import Prelude
3233
import Control.Alt ((<|>))
3334
import Control.Bind ((>=>))
3435
import Control.Monad.Eff (Eff())
36+
import Control.Monad.Eff.Exception as Exception
3537
import Control.Monad.Eff.Exception.Unsafe (unsafeThrow)
3638

3739
import Data.StrMap (StrMap())
@@ -212,6 +214,11 @@ type Error =
212214
, syscall :: String
213215
}
214216

217+
-- | Convert a ChildProcess.Error to a standard Error, which can then be thrown
218+
-- | inside an Eff or Aff computation (for example).
219+
toStandardError :: Error -> Exception.Error
220+
toStandardError = unsafeCoerce
221+
215222
-- | Behaviour for standard IO streams (eg, standard input, standard output) of
216223
-- | a child process.
217224
-- |

0 commit comments

Comments
 (0)