diff options
-rw-r--r-- | cli/dts/lib.deno.ns.d.ts | 56 | ||||
-rw-r--r-- | cli/dts/lib.deno.unstable.d.ts | 50 | ||||
-rw-r--r-- | cli/tests/unit/process_test.ts | 1 | ||||
-rw-r--r-- | runtime/js/90_deno_ns.js | 2 | ||||
-rw-r--r-- | runtime/ops/process.rs | 1 |
5 files changed, 52 insertions, 58 deletions
diff --git a/cli/dts/lib.deno.ns.d.ts b/cli/dts/lib.deno.ns.d.ts index 35d02776e..e1c23f10f 100644 --- a/cli/dts/lib.deno.ns.d.ts +++ b/cli/dts/lib.deno.ns.d.ts @@ -1956,14 +1956,46 @@ declare namespace Deno { stderrOutput(): Promise<Uint8Array>; close(): void; - /** **UNSTABLE** - * - * Send a signal to process. This functionality currently only works on - * Linux and Mac OS. + /** Send a signal to process. */ - kill(signo: string): void; // TODO(ry): Use Signal type here once made stable. + kill(signo: Signal): void; } + export type Signal = + | "SIGABRT" + | "SIGALRM" + | "SIGBUS" + | "SIGCHLD" + | "SIGCONT" + | "SIGEMT" + | "SIGFPE" + | "SIGHUP" + | "SIGILL" + | "SIGINFO" + | "SIGINT" + | "SIGIO" + | "SIGKILL" + | "SIGPIPE" + | "SIGPROF" + | "SIGPWR" + | "SIGQUIT" + | "SIGSEGV" + | "SIGSTKFLT" + | "SIGSTOP" + | "SIGSYS" + | "SIGTERM" + | "SIGTRAP" + | "SIGTSTP" + | "SIGTTIN" + | "SIGTTOU" + | "SIGURG" + | "SIGUSR1" + | "SIGUSR2" + | "SIGVTALRM" + | "SIGWINCH" + | "SIGXCPU" + | "SIGXFSZ"; + export type ProcessStatus = | { success: true; @@ -2481,6 +2513,20 @@ declare namespace Deno { options?: UpgradeWebSocketOptions, ): WebSocketUpgrade; + /** Send a signal to process under given `pid`. + * + * If `pid` is negative, the signal will be sent to the process group + * identified by `pid`. + * + * const p = Deno.run({ + * cmd: ["sleep", "10000"] + * }); + * + * Deno.kill(p.pid, "SIGINT"); + * + * Requires `allow-run` permission. */ + export function kill(pid: number, signo: Signal): void; + /** The type of the resource record. * Only the listed types are supported currently. */ export type RecordType = diff --git a/cli/dts/lib.deno.unstable.d.ts b/cli/dts/lib.deno.unstable.d.ts index a024713a8..b2fe0d9c7 100644 --- a/cli/dts/lib.deno.unstable.d.ts +++ b/cli/dts/lib.deno.unstable.d.ts @@ -562,41 +562,6 @@ declare namespace Deno { */ export function applySourceMap(location: Location): Location; - export type Signal = - | "SIGABRT" - | "SIGALRM" - | "SIGBUS" - | "SIGCHLD" - | "SIGCONT" - | "SIGEMT" - | "SIGFPE" - | "SIGHUP" - | "SIGILL" - | "SIGINFO" - | "SIGINT" - | "SIGIO" - | "SIGKILL" - | "SIGPIPE" - | "SIGPROF" - | "SIGPWR" - | "SIGQUIT" - | "SIGSEGV" - | "SIGSTKFLT" - | "SIGSTOP" - | "SIGSYS" - | "SIGTERM" - | "SIGTRAP" - | "SIGTSTP" - | "SIGTTIN" - | "SIGTTOU" - | "SIGURG" - | "SIGUSR1" - | "SIGUSR2" - | "SIGVTALRM" - | "SIGWINCH" - | "SIGXCPU" - | "SIGXFSZ"; - /** **UNSTABLE**: new API, yet to be vetted. * * Represents the stream of signals, implements both `AsyncIterator` and @@ -722,21 +687,6 @@ declare namespace Deno { }, >(opt: T): Process<T>; - /** **UNSTABLE**: Send a signal to process under given `pid`. This - * functionality only works on Linux and Mac OS. - * - * If `pid` is negative, the signal will be sent to the process group - * identified by `pid`. - * - * const p = Deno.run({ - * cmd: ["sleep", "10000"] - * }); - * - * Deno.kill(p.pid, "SIGINT"); - * - * Requires `allow-run` permission. */ - export function kill(pid: number, signo: Signal): void; - /** **UNSTABLE**: New API, yet to be vetted. Additional consideration is still * necessary around the permissions required. * diff --git a/cli/tests/unit/process_test.ts b/cli/tests/unit/process_test.ts index 8ac843973..f1cc756f4 100644 --- a/cli/tests/unit/process_test.ts +++ b/cli/tests/unit/process_test.ts @@ -121,7 +121,6 @@ unitTest( cmd: [ Deno.execPath(), "eval", - "--unstable", "Deno.kill(Deno.pid, 'SIGKILL')", ], }); diff --git a/runtime/js/90_deno_ns.js b/runtime/js/90_deno_ns.js index ddc18d425..28c7c48f5 100644 --- a/runtime/js/90_deno_ns.js +++ b/runtime/js/90_deno_ns.js @@ -104,6 +104,7 @@ serveHttp: __bootstrap.http.serveHttp, resolveDns: __bootstrap.net.resolveDns, upgradeWebSocket: __bootstrap.http.upgradeWebSocket, + kill: __bootstrap.process.kill, }; __bootstrap.denoNsUnstable = { @@ -111,7 +112,6 @@ Signal: __bootstrap.signals.Signal, SignalStream: __bootstrap.signals.SignalStream, emit: __bootstrap.compilerApi.emit, - kill: __bootstrap.process.kill, setRaw: __bootstrap.tty.setRaw, consoleSize: __bootstrap.tty.consoleSize, DiagnosticCategory: __bootstrap.diagnostics.DiagnosticCategory, diff --git a/runtime/ops/process.rs b/runtime/ops/process.rs index f6a472590..833b1822c 100644 --- a/runtime/ops/process.rs +++ b/runtime/ops/process.rs @@ -309,7 +309,6 @@ fn op_kill( pid: i32, signal: String, ) -> Result<(), AnyError> { - super::check_unstable(state, "Deno.kill"); state.borrow_mut::<Permissions>().run.check_all()?; kill(pid, &signal)?; Ok(()) |