Skip to content

Commit 38dcd31

Browse files
Add getUid/getGid (#43)
* Add more FFI * Fix PR numbers
1 parent d640163 commit 38dcd31

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@ Bugfixes:
1212

1313
Other improvements:
1414

15+
## [v11.1.0](https://github.com/purescript-node/purescript-node-process/releases/tag/v11.1.0) - 2023-07-24
16+
17+
New Features:
18+
- Add FFI for `getUid`/`getPid` (#43 by @JordanMartinez)
19+
1520
## [v11.0.1](https://github.com/purescript-node/purescript-node-process/releases/tag/v11.0.1) - 2023-07-21
1621

1722
Bugfixes:
18-
- Fix FFI for `channelRef`/`channelUnref` (#40 by @JordanMartinez)
23+
- Fix FFI for `channelRef`/`channelUnref` (#42 by @JordanMartinez)
1924

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

src/Node/Process.js

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ export const setExitCodeImpl = (code) => {
3030
process.exitCode = code;
3131
};
3232
export const getExitCodeImpl = () => process.exitCode;
33+
export const getGidImpl = () => process.getgid();
34+
export const getUidImpl = () => process.getuid();
3335
export const hasUncaughtExceptionCaptureCallback = () => process.hasUncaughtExceptionCaptureCallback;
3436
export const killImpl = (pid) => process.kill(pid);
3537
export const killStrImpl = (pid, sig) => process.kill(pid, sig);

src/Node/Process.purs

+13-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ module Node.Process
3838
, exit'
3939
, setExitCode
4040
, getExitCode
41+
, getGid
42+
, getUid
4143
, hasUncaughtExceptionCaptureCallback
4244
, kill
4345
, killStr
@@ -76,7 +78,7 @@ import Prelude
7678

7779
import Data.Maybe (Maybe)
7880
import Data.Nullable (Nullable, toMaybe)
79-
import Data.Posix (Pid)
81+
import Data.Posix (Gid, Pid, Uid)
8082
import Data.Posix.Signal (Signal)
8183
import Data.Posix.Signal as Signal
8284
import Data.String as String
@@ -384,6 +386,16 @@ getExitCode = map toMaybe getExitCodeImpl
384386

385387
foreign import getExitCodeImpl :: Effect (Nullable Int)
386388

389+
getGid :: Effect (Maybe Gid)
390+
getGid = map toMaybe getGidImpl
391+
392+
foreign import getGidImpl :: Effect (Nullable Gid)
393+
394+
getUid :: Effect (Maybe Uid)
395+
getUid = map toMaybe getUidImpl
396+
397+
foreign import getUidImpl :: Effect (Nullable Uid)
398+
387399
foreign import hasUncaughtExceptionCaptureCallback :: Effect (Boolean)
388400

389401
kill :: Pid -> Effect Unit

0 commit comments

Comments
 (0)