Skip to content

Commit 50f59c5

Browse files
committed
Add test for premature effect performing
1 parent 16219d0 commit 50f59c5

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/Main.purs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,26 @@ main = do
2121
nonExistentExecutable $ do
2222
log "all good."
2323

24+
log "doesn't perform effects too early"
25+
ls <- spawn "ls" ["-la"] defaultSpawnOptions
26+
let unused = kill SIGTERM ls
27+
onExit ls \exit ->
28+
case exit of
29+
Normally 0 ->
30+
log "All good!"
31+
_ -> do
32+
log ("Bad exit: expected `Normally 0`, got: " <> show exit)
33+
34+
log "kills processes"
35+
ls <- spawn "ls" ["-la"] defaultSpawnOptions
36+
kill SIGTERM ls
37+
onExit ls \exit ->
38+
case exit of
39+
BySignal SIGTERM ->
40+
log "All good!"
41+
_ -> do
42+
log ("Bad exit: expected `BySignal SIGTERM`, got: " <> show exit)
43+
2444
spawnLs = do
2545
ls <- spawn "ls" ["-la"] defaultSpawnOptions
2646
onExit ls \exit ->

0 commit comments

Comments
 (0)