Skip to content

Commit dbee01d

Browse files
committed
update test a bit
1 parent b51f269 commit dbee01d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/Main.purs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
module Test.Main where
22

33
import Prelude
4+
import Control.Apply
45
import Control.Bind
56

67
import Control.Monad.Eff.Console
8+
import Control.Monad.Eff.Console.Unsafe
79

810
import Node.Encoding (Encoding(UTF8))
911
import Node.Buffer as Buffer
@@ -12,7 +14,19 @@ import Node.ChildProcess.Signal
1214
import Node.Stream (onData)
1315

1416
main = do
17+
log "spawns processes ok"
18+
spawnLs
19+
20+
log "emits an error if executable does not exist"
21+
nonExistentExecutable $ do
22+
log "all good."
23+
24+
spawnLs = do
1525
ls <- spawn "ls" ["-la"] defaultSpawnOptions
1626
onExit ls \exit ->
1727
log $ "ls exited: " <> show exit
1828
onData (stdout ls) (Buffer.toString UTF8 >=> log)
29+
30+
nonExistentExecutable done = do
31+
ch <- spawn "this-does-not-exist" [] defaultSpawnOptions
32+
onError ch (\err -> logAny err *> done)

0 commit comments

Comments
 (0)