Deno.run

Spawns new subprocess. RunOptions must contain at a minimum the opt.cmd, an array of program arguments, the first of which is the binary.

const p = Deno.run({
  cmd: ["curl", "https://example.com"],
});
const status = await p.status();

Subprocess uses same working directory as parent process unless opt.cwd is specified.

Environmental variables from parent process can be cleared using opt.clearEnv. Doesn't guarantee that only opt.env variables are present, as the OS may set environmental variables for processes.

Environmental variables for subprocess can be specified using opt.env mapping.

opt.uid sets the child process’s user ID. This translates to a setuid call in the child process. Failure in the setuid call will cause the spawn to fail.

opt.gid is similar to opt.uid, but sets the group ID of the child process. This has the same semantics as the uid field.

By default subprocess inherits stdio of parent process. To change that opt.stdout, opt.stderr and opt.stdin can be specified independently - they can be set to either an rid of open file or set to "inherit" "piped" or "null":

"inherit" The default if unspecified. The child inherits from the corresponding parent descriptor.

"piped" A new pipe should be arranged to connect the parent and child sub-processes.

"null" This stream will be ignored. This is the equivalent of attaching the stream to /dev/null.

Details of the spawned process are returned.

Requires allow-run permission.

function run<T extends RunOptions = RunOptions>(opt: T): Process<T>;
§
run<T extends RunOptions = RunOptions>(opt: T): Process<T>
[src]

§Type Parameters

§Parameters

§
opt: T
[src]

§Return Type