Skip to content

Commit

Permalink
Add getUid/getGid (#43)
Browse files Browse the repository at this point in the history
* Add more FFI

* Fix PR numbers
  • Loading branch information
JordanMartinez authored Jul 25, 2023
1 parent d640163 commit 38dcd31
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@ Bugfixes:

Other improvements:

## [v11.1.0](https://github.com/purescript-node/purescript-node-process/releases/tag/v11.1.0) - 2023-07-24

New Features:
- Add FFI for `getUid`/`getPid` (#43 by @JordanMartinez)

## [v11.0.1](https://github.com/purescript-node/purescript-node-process/releases/tag/v11.0.1) - 2023-07-21

Bugfixes:
- Fix FFI for `channelRef`/`channelUnref` (#40 by @JordanMartinez)
- Fix FFI for `channelRef`/`channelUnref` (#42 by @JordanMartinez)

## [v11.0.0](https://github.com/purescript-node/purescript-node-process/releases/tag/v11.0.0) - 2023-07-21

Expand Down
2 changes: 2 additions & 0 deletions src/Node/Process.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export const setExitCodeImpl = (code) => {
process.exitCode = code;
};
export const getExitCodeImpl = () => process.exitCode;
export const getGidImpl = () => process.getgid();
export const getUidImpl = () => process.getuid();
export const hasUncaughtExceptionCaptureCallback = () => process.hasUncaughtExceptionCaptureCallback;
export const killImpl = (pid) => process.kill(pid);
export const killStrImpl = (pid, sig) => process.kill(pid, sig);
Expand Down
14 changes: 13 additions & 1 deletion src/Node/Process.purs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ module Node.Process
, exit'
, setExitCode
, getExitCode
, getGid
, getUid
, hasUncaughtExceptionCaptureCallback
, kill
, killStr
Expand Down Expand Up @@ -76,7 +78,7 @@ import Prelude

import Data.Maybe (Maybe)
import Data.Nullable (Nullable, toMaybe)
import Data.Posix (Pid)
import Data.Posix (Gid, Pid, Uid)
import Data.Posix.Signal (Signal)
import Data.Posix.Signal as Signal
import Data.String as String
Expand Down Expand Up @@ -384,6 +386,16 @@ getExitCode = map toMaybe getExitCodeImpl

foreign import getExitCodeImpl :: Effect (Nullable Int)

getGid :: Effect (Maybe Gid)
getGid = map toMaybe getGidImpl

foreign import getGidImpl :: Effect (Nullable Gid)

getUid :: Effect (Maybe Uid)
getUid = map toMaybe getUidImpl

foreign import getUidImpl :: Effect (Nullable Uid)

foreign import hasUncaughtExceptionCaptureCallback :: Effect (Boolean)

kill :: Pid -> Effect Unit
Expand Down

0 comments on commit 38dcd31

Please sign in to comment.