Skip to content

Commit d9ad6d0

Browse files
Fix another Kill signal type arg (#52)
* Fix another Kill signal type arg * Fix warning
1 parent 5e867de commit d9ad6d0

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ Other improvements:
1515
## [v11.0.0](https://github.com/purescript-node/purescript-node-child-process/releases/tag/v11.0.0) - 2023-07-25
1616

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

2020
- `Exit`'s `BySignal` constructor's arg
2121
- `exitH`/`closeH`'s signal arg
2222
- `spawnSync`'s `SpawnResult`'s `signal` field
23+
- `kill'`'s signal arg
2324

2425
New features:
2526
- Added `fromKillSignal` (#51 by @JordanMartinez)

src/Node/ChildProcess.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ disconnect = unsafeCoerce SafeCP.disconnect
173173
kill :: ChildProcess -> Effect Boolean
174174
kill = unsafeCoerce SafeCP.kill
175175

176-
kill' :: String -> ChildProcess -> Effect Boolean
176+
kill' :: KillSignal -> ChildProcess -> Effect Boolean
177177
kill' = unsafeCoerce SafeCP.kill'
178178

179179
-- | Send a signal to a child process. In the same way as the

src/Node/UnsafeChildProcess/Safe.purs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import Data.Posix.Signal as Signal
3636
import Effect (Effect)
3737
import Effect.Uncurried (EffectFn1, EffectFn2, mkEffectFn1, mkEffectFn2, runEffectFn1, runEffectFn2)
3838
import Foreign (Foreign)
39-
import Node.ChildProcess.Types (Exit(..), Handle, KillSignal, StdIO, UnsafeChildProcess, ipc, pipe)
39+
import Node.ChildProcess.Types (Exit(..), Handle, KillSignal, StdIO, UnsafeChildProcess, ipc, pipe, stringSignal)
4040
import Node.Errors.SystemError (SystemError)
4141
import Node.EventEmitter (EventEmitter, EventHandle(..))
4242
import Node.EventEmitter.UtilTypes (EventHandle0, EventHandle1)
@@ -102,10 +102,10 @@ kill cp = runEffectFn1 killImpl cp
102102

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

105-
kill' :: String -> UnsafeChildProcess -> Effect Boolean
105+
kill' :: KillSignal -> UnsafeChildProcess -> Effect Boolean
106106
kill' sig cp = runEffectFn2 killStrImpl cp sig
107107

108-
foreign import killStrImpl :: EffectFn2 (UnsafeChildProcess) (String) (Boolean)
108+
foreign import killStrImpl :: EffectFn2 (UnsafeChildProcess) (KillSignal) (Boolean)
109109

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

121121
killed :: UnsafeChildProcess -> Effect Boolean
122122
killed cp = runEffectFn1 killedImpl cp

0 commit comments

Comments
 (0)