diff --git a/CHANGELOG.md b/CHANGELOG.md index e42b51a..eece8db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,11 @@ Bugfixes: Other improvements: +## [v10.1.0](https://github.com/purescript-node/purescript-node-child-process/releases/tag/v10.1.0) - 2023-07-25 + +Other improvements: +- Fix regression: add `ref`/`unref` APIs that were dropped in `v10.0.0` (#50 by @JordanMartinez) + ## [v10.0.0](https://github.com/purescript-node/purescript-node-child-process/releases/tag/v10.0.0) - 2023-07-20 Breaking changes: diff --git a/src/Node/ChildProcess.purs b/src/Node/ChildProcess.purs index 0c5b7d6..0ad853c 100644 --- a/src/Node/ChildProcess.purs +++ b/src/Node/ChildProcess.purs @@ -51,6 +51,8 @@ module Node.ChildProcess , kill' , killSignal , killed + , ref + , unref , signalCode , spawnFile , spawnArgs @@ -188,6 +190,12 @@ killSignal = unsafeCoerce SafeCP.killSignal killed :: ChildProcess -> Effect Boolean killed = unsafeCoerce SafeCP.killed +ref :: ChildProcess -> Effect Unit +ref = unsafeCoerce SafeCP.ref + +unref :: ChildProcess -> Effect Unit +unref = unsafeCoerce SafeCP.unref + signalCode :: ChildProcess -> Effect (Maybe String) signalCode = unsafeCoerce SafeCP.signalCode diff --git a/src/Node/UnsafeChildProcess/Safe.js b/src/Node/UnsafeChildProcess/Safe.js index 6cea788..e2c744a 100644 --- a/src/Node/UnsafeChildProcess/Safe.js +++ b/src/Node/UnsafeChildProcess/Safe.js @@ -5,6 +5,8 @@ export const pidImpl = (cp) => cp.pid; export const killImpl = (cp) => cp.kill(); export const killStrImpl = (cp, str) => cp.kill(str); export const killedImpl = (cp) => cp.killed; +export const refImpl = (cp) => cp.ref(); +export const unrefImpl = (cp) => cp.unref(); export const signalCodeImpl = (cp) => cp.signalCode; export const spawnArgs = (cp) => cp.spawnArgs; export const spawnFile = (cp) => cp.spawnFile; diff --git a/src/Node/UnsafeChildProcess/Safe.purs b/src/Node/UnsafeChildProcess/Safe.purs index 29d5678..ce61bd5 100644 --- a/src/Node/UnsafeChildProcess/Safe.purs +++ b/src/Node/UnsafeChildProcess/Safe.purs @@ -17,10 +17,13 @@ module Node.UnsafeChildProcess.Safe , kill' , killSignal , killed + , ref + , unref , signalCode , spawnFile , spawnArgs , safeStdio + ) where import Prelude @@ -120,6 +123,16 @@ killed cp = runEffectFn1 killedImpl cp foreign import killedImpl :: EffectFn1 (UnsafeChildProcess) (Boolean) +ref :: UnsafeChildProcess -> Effect Unit +ref cp = runEffectFn1 refImpl cp + +foreign import refImpl :: EffectFn1 (UnsafeChildProcess) (Unit) + +unref :: UnsafeChildProcess -> Effect Unit +unref cp = runEffectFn1 unrefImpl cp + +foreign import unrefImpl :: EffectFn1 (UnsafeChildProcess) (Unit) + signalCode :: UnsafeChildProcess -> Effect (Maybe String) signalCode cp = map toMaybe $ runEffectFn1 signalCodeImpl cp