Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/xdg/vendor/types/deno.d.ts>Deno.Process

Determine XDG Base Directory paths (OS/platform portable)
Go to Latest
class Deno.Process
import { Deno } from "https://deno.land/x/xdg@v10.5.1/vendor/types/deno.d.ts";
const { Process } = Deno;

Properties

readonly
pid: number
readonly
rid: number
readonly
stderr: T["stderr"] extends "piped" ? Reader & Closer : (Reader & Closer) | null
readonly
stdin: T["stdin"] extends "piped" ? Writer & Closer : (Writer & Closer) | null
readonly
stdout: T["stdout"] extends "piped" ? Reader & Closer : (Reader & Closer) | null

Methods

close(): void
kill(signo: number): void

UNSTABLE: The signo argument may change to require the Deno.Signal enum.

Send a signal to process. This functionality currently only works on Linux and Mac OS.

output(): Promise<Uint8Array>

Buffer the stdout until EOF and return it as Uint8Array.

You must set stdout to "piped" when creating the process.

This calls close() on stdout after its done.

status(): Promise<ProcessStatus>

Wait for the process to exit and return its exit status.

Calling this function multiple times will return the same status.

Stdin handle to the process will be closed before waiting to avoid a deadlock.

If stdout and/or stderr were set to "piped", they must be closed manually before the process can exit.

To run process to completion and collect output from both stdout and stderr use:

const p = Deno.run({ cmd, stderr: 'piped', stdout: 'piped' });
const [status, stdout, stderr] = await Promise.all([
  p.status(),
  p.output(),
  p.stderrOutput()
]);
p.close();
stderrOutput(): Promise<Uint8Array>

Buffer the stderr until EOF and return it as Uint8Array.

You must set stderr to "piped" when creating the process.

This calls close() on stderr after its done.