Skip to content

Add Show instance to Shell/KillSignal #58

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 1 commit 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 @@ -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