Skip to content

Commit 32f1a0c

Browse files
committed
exec/execFile returns a ChildProcess
1 parent aa95081 commit 32f1a0c

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/Node/ChildProcess.purs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ exec
236236
:: String
237237
-> ExecOptions
238238
-> (ExecResult -> Effect Unit)
239-
-> Effect Unit
239+
-> Effect ChildProcess
240240
exec cmd opts callback =
241241
execImpl cmd (convertExecOptions opts) \err stdout' stderr' ->
242242
callback
@@ -249,7 +249,7 @@ foreign import execImpl
249249
:: String
250250
-> ActualExecOptions
251251
-> (Nullable Exception.Error -> Buffer -> Buffer -> Effect Unit)
252-
-> Effect Unit
252+
-> Effect ChildProcess
253253

254254
-- | Like `exec`, except instead of using a shell, it passes the arguments
255255
-- | directly to the specified command.
@@ -258,7 +258,7 @@ execFile
258258
-> Array String
259259
-> ExecOptions
260260
-> (ExecResult -> Effect Unit)
261-
-> Effect Unit
261+
-> Effect ChildProcess
262262
execFile cmd args opts callback =
263263
execFileImpl cmd args (convertExecOptions opts) \err stdout' stderr' ->
264264
callback
@@ -272,7 +272,7 @@ foreign import execFileImpl
272272
-> Array String
273273
-> ActualExecOptions
274274
-> (Nullable Exception.Error -> Buffer -> Buffer -> Effect Unit)
275-
-> Effect Unit
275+
-> Effect ChildProcess
276276

277277
foreign import data ActualExecOptions :: Type
278278

test/Main.purs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ nonExistentExecutable done = do
5858

5959
execLs :: Effect Unit
6060
execLs = do
61-
exec "ls >&2" defaultExecOptions \r ->
61+
-- returned ChildProcess is ignored here
62+
_ <- exec "ls >&2" defaultExecOptions \r ->
6263
log "redirected to stderr:" *> (Buffer.toString UTF8 r.stderr >>= log)
64+
pure unit
6365

6466
execSyncEcho :: String -> Effect Unit
6567
execSyncEcho str = do

0 commit comments

Comments
 (0)