Skip to content

Commit

Permalink
Add Show instance to Shell/KillSignal
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanMartinez committed Jul 25, 2023
1 parent 258e3a9 commit cb2fd40
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ Breaking changes:
New features:
- Added `fromKillSignal` (#51 by @JordanMartinez)
- Added `pidExists` (#53 by @JordanMartinez)
- Export `toUnsafeChildProcess` (#54 by @JordanMartinez)
- Export `toUnsafeChildProcess` (#55 by @JordanMartinez)
- Added `stdio` (#55 by @JordanMartinez)
- Added `Show` instance to `Shell` & `KillSignal` (#58 by @JordanMartinez)

Other improvements:
- Fix regression: add `ref`/`unref` APIs that were dropped in `v10.0.0` (#50 by @JordanMartinez)
Expand Down
2 changes: 2 additions & 0 deletions src/Node/ChildProcess/Types.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export const showKillSignal = (ks) => ks + "";
export const showShell = (shell) => shell + "";
export const fromKillSignalImpl = (left, right, sig) => {
const ty = typeof sig;
if (ty === "number") return right(sig | 0);
Expand Down
10 changes: 10 additions & 0 deletions src/Node/ChildProcess/Types.purs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ defaultStdIO = unsafeCoerce (null :: Nullable String)

foreign import data KillSignal :: Type

instance Show KillSignal where
show = showKillSignal

foreign import showKillSignal :: KillSignal -> String

intSignal :: Int -> KillSignal
intSignal = unsafeCoerce

Expand All @@ -85,6 +90,11 @@ foreign import fromKillSignalImpl :: Fn3 (forall l r. l -> Either l r) (forall l

foreign import data Shell :: Type

instance Show Shell where
show = showShell

foreign import showShell :: Shell -> String

enableShell :: Shell
enableShell = unsafeCoerce true

Expand Down

0 comments on commit cb2fd40

Please sign in to comment.