Skip to content

Commit 258e3a9

Browse files
Add stdio (#56)
* Add stdio
1 parent 5af300b commit 258e3a9

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ New features:
2626
- Added `fromKillSignal` (#51 by @JordanMartinez)
2727
- Added `pidExists` (#53 by @JordanMartinez)
2828
- Export `toUnsafeChildProcess` (#54 by @JordanMartinez)
29+
- Added `stdio` (#55 by @JordanMartinez)
2930

3031
Other improvements:
3132
- Fix regression: add `ref`/`unref` APIs that were dropped in `v10.0.0` (#50 by @JordanMartinez)

src/Node/ChildProcess.purs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ module Node.ChildProcess
5858
, signalCode
5959
, spawnFile
6060
, spawnArgs
61+
, stdio
6162
, spawnSync
6263
, SpawnSyncOptions
6364
, spawnSync'
@@ -210,6 +211,9 @@ spawnArgs cp = SafeCP.spawnArgs $ toUnsafeChildProcess cp
210211
spawnFile :: ChildProcess -> String
211212
spawnFile cp = SafeCP.spawnFile $ toUnsafeChildProcess cp
212213

214+
stdio :: ChildProcess -> Array StdIO
215+
stdio cp = SafeCP.stdio $ toUnsafeChildProcess cp
216+
213217
-- | Note: `exitStatus` combines the `status` and `signal` fields
214218
-- | from the value normally returned by `spawnSync` into one value
215219
-- | since only one of them can be non-null at the end.

src/Node/UnsafeChildProcess/Safe.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ export const unrefImpl = (cp) => cp.unref();
1010
export const signalCodeImpl = (cp) => cp.signalCode;
1111
export const spawnArgs = (cp) => cp.spawnArgs;
1212
export const spawnFile = (cp) => cp.spawnFile;
13+
export const stdio = (cp) => cp.stdio;

src/Node/UnsafeChildProcess/Safe.purs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ module Node.UnsafeChildProcess.Safe
2323
, signalCode
2424
, spawnFile
2525
, spawnArgs
26+
, stdio
2627
, safeStdio
27-
2828
) where
2929

3030
import Prelude
@@ -148,6 +148,8 @@ foreign import spawnArgs :: UnsafeChildProcess -> Array String
148148

149149
foreign import spawnFile :: UnsafeChildProcess -> String
150150

151+
foreign import stdio :: UnsafeChildProcess -> Array StdIO
152+
151153
-- | Safe default configuration for an UnsafeChildProcess.
152154
-- | `[ pipe, pipe, pipe, ipc ]`.
153155
-- | Creates a new stream for `stdin`, `stdout`, and `stderr`

0 commit comments

Comments
 (0)