diff options
author | James Bradlee <post@jamesb.no> | 2022-05-31 10:42:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-31 17:42:44 +0900 |
commit | c41544ac7b502fbdb6c1ee96a604490b72eb7770 (patch) | |
tree | e2b855a0c722feddf170ffb11c2a7f756a7f1e56 /runtime/ops/os.rs | |
parent | d9ed5e905c25bd415b5e65649a44e0a1580e5ed1 (diff) |
feat(unstable): add Deno.getGid (#14528)
Diffstat (limited to 'runtime/ops/os.rs')
-rw-r--r-- | runtime/ops/os.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/runtime/ops/os.rs b/runtime/ops/os.rs index c74a423ab..37da410ca 100644 --- a/runtime/ops/os.rs +++ b/runtime/ops/os.rs @@ -22,6 +22,7 @@ pub fn init(maybe_exit_code: Option<Arc<AtomicI32>>) -> Extension { op_exit::decl(), op_delete_env::decl(), op_get_env::decl(), + op_getgid::decl(), op_getuid::decl(), op_hostname::decl(), op_loadavg::decl(), @@ -227,6 +228,22 @@ fn op_system_memory_info( #[cfg(not(windows))] #[op] +fn op_getgid(state: &mut OpState) -> Result<Option<u32>, AnyError> { + super::check_unstable(state, "Deno.getGid"); + state.borrow_mut::<Permissions>().env.check_all()?; + unsafe { Ok(Some(libc::getgid())) } +} + +#[cfg(windows)] +#[op] +fn op_getgid(state: &mut OpState) -> Result<Option<u32>, AnyError> { + super::check_unstable(state, "Deno.getGid"); + state.borrow_mut::<Permissions>().env.check_all()?; + Ok(None) +} + +#[cfg(not(windows))] +#[op] fn op_getuid(state: &mut OpState) -> Result<Option<u32>, AnyError> { super::check_unstable(state, "Deno.getUid"); state.borrow_mut::<Permissions>().env.check_all()?; |