Skip to content

Fix another Kill signal type arg #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ Other improvements:
## [v11.0.0](https://github.com/purescript-node/purescript-node-child-process/releases/tag/v11.0.0) - 2023-07-25

Breaking changes:
- Update the signal arg from `String` to `KillSignal` (#51 by @JordanMartinez)
- Update the signal arg from `String` to `KillSignal` (#51, #52 by @JordanMartinez)

- `Exit`'s `BySignal` constructor's arg
- `exitH`/`closeH`'s signal arg
- `spawnSync`'s `SpawnResult`'s `signal` field
- `kill'`'s signal arg

New features:
- Added `fromKillSignal` (#51 by @JordanMartinez)
Expand Down
2 changes: 1 addition & 1 deletion src/Node/ChildProcess.purs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ disconnect = unsafeCoerce SafeCP.disconnect
kill :: ChildProcess -> Effect Boolean
kill = unsafeCoerce SafeCP.kill

kill' :: String -> ChildProcess -> Effect Boolean
kill' :: KillSignal -> ChildProcess -> Effect Boolean
kill' = unsafeCoerce SafeCP.kill'

-- | Send a signal to a child process. In the same way as the
Expand Down
8 changes: 4 additions & 4 deletions src/Node/UnsafeChildProcess/Safe.purs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import Data.Posix.Signal as Signal
import Effect (Effect)
import Effect.Uncurried (EffectFn1, EffectFn2, mkEffectFn1, mkEffectFn2, runEffectFn1, runEffectFn2)
import Foreign (Foreign)
import Node.ChildProcess.Types (Exit(..), Handle, KillSignal, StdIO, UnsafeChildProcess, ipc, pipe)
import Node.ChildProcess.Types (Exit(..), Handle, KillSignal, StdIO, UnsafeChildProcess, ipc, pipe, stringSignal)
import Node.Errors.SystemError (SystemError)
import Node.EventEmitter (EventEmitter, EventHandle(..))
import Node.EventEmitter.UtilTypes (EventHandle0, EventHandle1)
Expand Down Expand Up @@ -102,10 +102,10 @@ kill cp = runEffectFn1 killImpl cp

foreign import killImpl :: EffectFn1 (UnsafeChildProcess) (Boolean)

kill' :: String -> UnsafeChildProcess -> Effect Boolean
kill' :: KillSignal -> UnsafeChildProcess -> Effect Boolean
kill' sig cp = runEffectFn2 killStrImpl cp sig

foreign import killStrImpl :: EffectFn2 (UnsafeChildProcess) (String) (Boolean)
foreign import killStrImpl :: EffectFn2 (UnsafeChildProcess) (KillSignal) (Boolean)

-- | Send a signal to a child process. In the same way as the
-- | [unix kill(2) system call](https://linux.die.net/man/2/kill),
Expand All @@ -116,7 +116,7 @@ foreign import killStrImpl :: EffectFn2 (UnsafeChildProcess) (String) (Boolean)
-- | The child process might emit an `"error"` event if the signal
-- | could not be delivered.
killSignal :: Signal -> UnsafeChildProcess -> Effect Boolean
killSignal sig cp = kill' (Signal.toString sig) cp
killSignal sig cp = kill' (stringSignal $ Signal.toString sig) cp

killed :: UnsafeChildProcess -> Effect Boolean
killed cp = runEffectFn1 killedImpl cp
Expand Down