File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 11module Test.Main where
22
33import Prelude
4+ import Control.Apply
45import Control.Bind
56
67import Control.Monad.Eff.Console
8+ import Control.Monad.Eff.Console.Unsafe
79
810import Node.Encoding (Encoding (UTF8))
911import Node.Buffer as Buffer
@@ -12,7 +14,19 @@ import Node.ChildProcess.Signal
1214import Node.Stream (onData )
1315
1416main = 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)
You can’t perform that action at this time.
0 commit comments