Skip to content

Commit

Permalink
Add stdio (#56)
Browse files Browse the repository at this point in the history
* Add stdio
  • Loading branch information
JordanMartinez authored Jul 25, 2023
1 parent 5af300b commit 258e3a9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ New features:
- Added `fromKillSignal` (#51 by @JordanMartinez)
- Added `pidExists` (#53 by @JordanMartinez)
- Export `toUnsafeChildProcess` (#54 by @JordanMartinez)
- Added `stdio` (#55 by @JordanMartinez)

Other improvements:
- Fix regression: add `ref`/`unref` APIs that were dropped in `v10.0.0` (#50 by @JordanMartinez)
Expand Down
4 changes: 4 additions & 0 deletions src/Node/ChildProcess.purs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ module Node.ChildProcess
, signalCode
, spawnFile
, spawnArgs
, stdio
, spawnSync
, SpawnSyncOptions
, spawnSync'
Expand Down Expand Up @@ -210,6 +211,9 @@ spawnArgs cp = SafeCP.spawnArgs $ toUnsafeChildProcess cp
spawnFile :: ChildProcess -> String
spawnFile cp = SafeCP.spawnFile $ toUnsafeChildProcess cp

stdio :: ChildProcess -> Array StdIO
stdio cp = SafeCP.stdio $ toUnsafeChildProcess cp

-- | Note: `exitStatus` combines the `status` and `signal` fields
-- | from the value normally returned by `spawnSync` into one value
-- | since only one of them can be non-null at the end.
Expand Down
1 change: 1 addition & 0 deletions src/Node/UnsafeChildProcess/Safe.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export const unrefImpl = (cp) => cp.unref();
export const signalCodeImpl = (cp) => cp.signalCode;
export const spawnArgs = (cp) => cp.spawnArgs;
export const spawnFile = (cp) => cp.spawnFile;
export const stdio = (cp) => cp.stdio;
4 changes: 3 additions & 1 deletion src/Node/UnsafeChildProcess/Safe.purs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ module Node.UnsafeChildProcess.Safe
, signalCode
, spawnFile
, spawnArgs
, stdio
, safeStdio

) where

import Prelude
Expand Down Expand Up @@ -148,6 +148,8 @@ foreign import spawnArgs :: UnsafeChildProcess -> Array String

foreign import spawnFile :: UnsafeChildProcess -> String

foreign import stdio :: UnsafeChildProcess -> Array StdIO

-- | Safe default configuration for an UnsafeChildProcess.
-- | `[ pipe, pipe, pipe, ipc ]`.
-- | Creates a new stream for `stdin`, `stdout`, and `stderr`
Expand Down

0 comments on commit 258e3a9

Please sign in to comment.