mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 20:29:11 +00: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
|
* @category Timers
|
||||||
*/
|
*/
|
||||||
export function unrefTimer(id: number): void;
|
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;
|
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.
|
/** **UNSTABLE**: New API, yet to be vetted.
|
||||||
*
|
*
|
||||||
* All plain number types for interfacing with foreign functions.
|
* All plain number types for interfacing with foreign functions.
|
||||||
|
|
|
@ -124,12 +124,12 @@
|
||||||
systemMemoryInfo: __bootstrap.os.systemMemoryInfo,
|
systemMemoryInfo: __bootstrap.os.systemMemoryInfo,
|
||||||
networkInterfaces: __bootstrap.os.networkInterfaces,
|
networkInterfaces: __bootstrap.os.networkInterfaces,
|
||||||
consoleSize: __bootstrap.tty.consoleSize,
|
consoleSize: __bootstrap.tty.consoleSize,
|
||||||
|
gid: __bootstrap.os.gid,
|
||||||
|
uid: __bootstrap.os.uid,
|
||||||
};
|
};
|
||||||
|
|
||||||
__bootstrap.denoNsUnstable = {
|
__bootstrap.denoNsUnstable = {
|
||||||
DiagnosticCategory: __bootstrap.diagnostics.DiagnosticCategory,
|
DiagnosticCategory: __bootstrap.diagnostics.DiagnosticCategory,
|
||||||
gid: __bootstrap.os.gid,
|
|
||||||
uid: __bootstrap.os.uid,
|
|
||||||
listenDatagram: __bootstrap.net.listenDatagram,
|
listenDatagram: __bootstrap.net.listenDatagram,
|
||||||
umask: __bootstrap.fs.umask,
|
umask: __bootstrap.fs.umask,
|
||||||
HttpClient: __bootstrap.fetch.HttpClient,
|
HttpClient: __bootstrap.fetch.HttpClient,
|
||||||
|
|
|
@ -255,7 +255,6 @@ fn op_system_memory_info(
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
#[op]
|
#[op]
|
||||||
fn op_gid(state: &mut OpState) -> Result<Option<u32>, AnyError> {
|
fn op_gid(state: &mut OpState) -> Result<Option<u32>, AnyError> {
|
||||||
super::check_unstable(state, "Deno.gid");
|
|
||||||
state
|
state
|
||||||
.borrow_mut::<Permissions>()
|
.borrow_mut::<Permissions>()
|
||||||
.sys
|
.sys
|
||||||
|
@ -270,7 +269,6 @@ fn op_gid(state: &mut OpState) -> Result<Option<u32>, AnyError> {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
#[op]
|
#[op]
|
||||||
fn op_gid(state: &mut OpState) -> Result<Option<u32>, AnyError> {
|
fn op_gid(state: &mut OpState) -> Result<Option<u32>, AnyError> {
|
||||||
super::check_unstable(state, "Deno.gid");
|
|
||||||
state
|
state
|
||||||
.borrow_mut::<Permissions>()
|
.borrow_mut::<Permissions>()
|
||||||
.sys
|
.sys
|
||||||
|
@ -281,7 +279,6 @@ fn op_gid(state: &mut OpState) -> Result<Option<u32>, AnyError> {
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
#[op]
|
#[op]
|
||||||
fn op_uid(state: &mut OpState) -> Result<Option<u32>, AnyError> {
|
fn op_uid(state: &mut OpState) -> Result<Option<u32>, AnyError> {
|
||||||
super::check_unstable(state, "Deno.uid");
|
|
||||||
state
|
state
|
||||||
.borrow_mut::<Permissions>()
|
.borrow_mut::<Permissions>()
|
||||||
.sys
|
.sys
|
||||||
|
@ -296,7 +293,6 @@ fn op_uid(state: &mut OpState) -> Result<Option<u32>, AnyError> {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
#[op]
|
#[op]
|
||||||
fn op_uid(state: &mut OpState) -> Result<Option<u32>, AnyError> {
|
fn op_uid(state: &mut OpState) -> Result<Option<u32>, AnyError> {
|
||||||
super::check_unstable(state, "Deno.uid");
|
|
||||||
state
|
state
|
||||||
.borrow_mut::<Permissions>()
|
.borrow_mut::<Permissions>()
|
||||||
.sys
|
.sys
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue