mirror of
https://github.com/denoland/deno.git
synced 2025-01-08 07:08:27 -05:00
fix(ext/node): add process.abort() (#21742)
This commit is contained in:
parent
d3ef599c8f
commit
73b703213e
3 changed files with 13 additions and 0 deletions
|
@ -282,6 +282,7 @@ deno_core::extension!(deno_node,
|
||||||
ops::os::op_node_os_username<P>,
|
ops::os::op_node_os_username<P>,
|
||||||
ops::os::op_geteuid<P>,
|
ops::os::op_geteuid<P>,
|
||||||
ops::os::op_cpus<P>,
|
ops::os::op_cpus<P>,
|
||||||
|
ops::os::op_process_abort,
|
||||||
op_node_build_os,
|
op_node_build_os,
|
||||||
op_node_is_promise_rejected,
|
op_node_is_promise_rejected,
|
||||||
op_npm_process_state,
|
op_npm_process_state,
|
||||||
|
|
|
@ -75,6 +75,11 @@ where
|
||||||
Ok(euid)
|
Ok(euid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[op2(fast)]
|
||||||
|
pub fn op_process_abort() {
|
||||||
|
std::process::abort();
|
||||||
|
}
|
||||||
|
|
||||||
#[op2]
|
#[op2]
|
||||||
#[serde]
|
#[serde]
|
||||||
pub fn op_cpus<P>(state: &mut OpState) -> Result<Vec<cpus::CpuInfo>, AnyError>
|
pub fn op_cpus<P>(state: &mut OpState) -> Result<Vec<cpus::CpuInfo>, AnyError>
|
||||||
|
|
|
@ -98,6 +98,10 @@ export const exit = (code?: number | string) => {
|
||||||
process.reallyExit(process.exitCode || 0);
|
process.reallyExit(process.exitCode || 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const abort = () => {
|
||||||
|
ops.op_process_abort();
|
||||||
|
};
|
||||||
|
|
||||||
function addReadOnlyProcessAlias(
|
function addReadOnlyProcessAlias(
|
||||||
name: string,
|
name: string,
|
||||||
option: string,
|
option: string,
|
||||||
|
@ -415,6 +419,9 @@ class Process extends EventEmitter {
|
||||||
/** https://nodejs.org/api/process.html#process_process_exit_code */
|
/** https://nodejs.org/api/process.html#process_process_exit_code */
|
||||||
exit = exit;
|
exit = exit;
|
||||||
|
|
||||||
|
/** https://nodejs.org/api/process.html#processabort */
|
||||||
|
abort = abort;
|
||||||
|
|
||||||
// Undocumented Node API that is used by `signal-exit` which in turn
|
// Undocumented Node API that is used by `signal-exit` which in turn
|
||||||
// is used by `node-tap`. It was marked for removal a couple of years
|
// is used by `node-tap`. It was marked for removal a couple of years
|
||||||
// ago. See https://github.com/nodejs/node/blob/6a6b3c54022104cc110ab09044a2a0cecb8988e7/lib/internal/bootstrap/node.js#L172
|
// ago. See https://github.com/nodejs/node/blob/6a6b3c54022104cc110ab09044a2a0cecb8988e7/lib/internal/bootstrap/node.js#L172
|
||||||
|
|
Loading…
Reference in a new issue