import { run } from "https://deno.land/x/ayonli_jsext@v0.9.72/cli.ts";
Executes a command in the terminal and returns the exit code and outputs.
In Windows, this function will use PowerShell to execute the command when
possible, which has a lot UNIX-like aliases/commands available, such as ls
,
cat
, rm
, etc.
Examples
Example 1
Example 1
import { run } from "@ayonli/jsext/cli";
const { code, stdout, stderr } = await run("echo", ["Hello, World!"]);
console.log(code); // 0
console.log(JSON.stringify(stdout)); // "Hello, World!\n"
console.log(JSON.stringify(stderr)); // ""
Returns
Promise<CommandResult>