mirror of
https://github.com/denoland/deno.git
synced 2025-01-11 00:21:05 -05:00
feat: stabilize Deno.uid() and Deno.gid() (#16424)
Closes https://github.com/denoland/deno_std/issues/2791
This commit is contained in:
parent
0500aa1f71
commit
c36496b3bb
4 changed files with 30 additions and 38 deletions
28
cli/dts/lib.deno.ns.d.ts
vendored
28
cli/dts/lib.deno.ns.d.ts
vendored
|
@ -4950,4 +4950,32 @@ declare namespace Deno {
|
|||
* @category Timers
|
||||
*/
|
||||
export function unrefTimer(id: number): void;
|
||||
|
||||
/**
|
||||
* Returns the user id of the process on POSIX platforms. Returns null on Windows.
|
||||
*
|
||||
* ```ts
|
||||
* console.log(Deno.uid());
|
||||
* ```
|
||||
*
|
||||
* Requires `allow-sys` permission.
|
||||
*
|
||||
* @tags allow-sys
|
||||
* @category Runtime Environment
|
||||
*/
|
||||
export function uid(): number | null;
|
||||
|
||||
/**
|
||||
* Returns the group id of the process on POSIX platforms. Returns null on windows.
|
||||
*
|
||||
* ```ts
|
||||
* console.log(Deno.gid());
|
||||
* ```
|
||||
*
|
||||
* Requires `allow-sys` permission.
|
||||
*
|
||||
* @tags allow-sys
|
||||
* @category Runtime Environment
|
||||
*/
|
||||
export function gid(): number | null;
|
||||
}
|
||||
|
|
32
cli/dts/lib.deno.unstable.d.ts
vendored
32
cli/dts/lib.deno.unstable.d.ts
vendored
|
@ -269,38 +269,6 @@ declare namespace Deno {
|
|||
*/
|
||||
export function umask(mask?: number): number;
|
||||
|
||||
/** **UNSTABLE**: New API, yet to be vetted.
|
||||
*
|
||||
* Returns the user id of the Deno process on POSIX platforms. Returns `null`
|
||||
* on Windows.
|
||||
*
|
||||
* ```ts
|
||||
* console.log(Deno.uid());
|
||||
* ```
|
||||
*
|
||||
* Requires `allow-sys` permission.
|
||||
*
|
||||
* @tags allow-sys
|
||||
* @category Runtime Environment
|
||||
*/
|
||||
export function uid(): number | null;
|
||||
|
||||
/** **UNSTABLE**: New API, yet to be vetted.
|
||||
*
|
||||
* Returns the group id of the process on POSIX platforms. Returns `null` on
|
||||
* Windows.
|
||||
*
|
||||
* ```ts
|
||||
* console.log(Deno.gid());
|
||||
* ```
|
||||
*
|
||||
* Requires `allow-sys` permission.
|
||||
*
|
||||
* @tags allow-sys
|
||||
* @category Runtime Environment
|
||||
*/
|
||||
export function gid(): number | null;
|
||||
|
||||
/** **UNSTABLE**: New API, yet to be vetted.
|
||||
*
|
||||
* All plain number types for interfacing with foreign functions.
|
||||
|
|
|
@ -124,12 +124,12 @@
|
|||
systemMemoryInfo: __bootstrap.os.systemMemoryInfo,
|
||||
networkInterfaces: __bootstrap.os.networkInterfaces,
|
||||
consoleSize: __bootstrap.tty.consoleSize,
|
||||
gid: __bootstrap.os.gid,
|
||||
uid: __bootstrap.os.uid,
|
||||
};
|
||||
|
||||
__bootstrap.denoNsUnstable = {
|
||||
DiagnosticCategory: __bootstrap.diagnostics.DiagnosticCategory,
|
||||
gid: __bootstrap.os.gid,
|
||||
uid: __bootstrap.os.uid,
|
||||
listenDatagram: __bootstrap.net.listenDatagram,
|
||||
umask: __bootstrap.fs.umask,
|
||||
HttpClient: __bootstrap.fetch.HttpClient,
|
||||
|
|
|
@ -255,7 +255,6 @@ fn op_system_memory_info(
|
|||
#[cfg(not(windows))]
|
||||
#[op]
|
||||
fn op_gid(state: &mut OpState) -> Result<Option<u32>, AnyError> {
|
||||
super::check_unstable(state, "Deno.gid");
|
||||
state
|
||||
.borrow_mut::<Permissions>()
|
||||
.sys
|
||||
|
@ -270,7 +269,6 @@ fn op_gid(state: &mut OpState) -> Result<Option<u32>, AnyError> {
|
|||
#[cfg(windows)]
|
||||
#[op]
|
||||
fn op_gid(state: &mut OpState) -> Result<Option<u32>, AnyError> {
|
||||
super::check_unstable(state, "Deno.gid");
|
||||
state
|
||||
.borrow_mut::<Permissions>()
|
||||
.sys
|
||||
|
@ -281,7 +279,6 @@ fn op_gid(state: &mut OpState) -> Result<Option<u32>, AnyError> {
|
|||
#[cfg(not(windows))]
|
||||
#[op]
|
||||
fn op_uid(state: &mut OpState) -> Result<Option<u32>, AnyError> {
|
||||
super::check_unstable(state, "Deno.uid");
|
||||
state
|
||||
.borrow_mut::<Permissions>()
|
||||
.sys
|
||||
|
@ -296,7 +293,6 @@ fn op_uid(state: &mut OpState) -> Result<Option<u32>, AnyError> {
|
|||
#[cfg(windows)]
|
||||
#[op]
|
||||
fn op_uid(state: &mut OpState) -> Result<Option<u32>, AnyError> {
|
||||
super::check_unstable(state, "Deno.uid");
|
||||
state
|
||||
.borrow_mut::<Permissions>()
|
||||
.sys
|
||||
|
|
Loading…
Reference in a new issue