aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PursLoader/ChildProcess.purs
blob: 3bd960b784b12f6016f489ca020c91fd06a205ae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module PursLoader.ChildProcess
  ( ChildProcess()
  , spawn
  ) where

import Prelude (Unit(), ($))

import Control.Monad.Aff (Aff(), makeAff)
import Control.Monad.Eff (Eff())
import Control.Monad.Eff.Exception (Error())

import Data.Function

foreign import data ChildProcess :: !

spawn :: forall eff. String -> Array String -> Aff (cp :: ChildProcess | eff) String
spawn command args = makeAff $ runFn4 spawnFn command args

foreign import spawnFn :: forall eff. Fn4 String
                                          (Array String)
                                          (Error -> Eff (cp :: ChildProcess | eff) Unit)
                                          (String -> Eff (cp :: ChildProcess | eff) Unit)
                                          (Eff (cp :: ChildProcess | eff) Unit)