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

x/ayonli_jsext/cli.ts>run

A JavaScript extension package for building strong and modern applications.
Latest
function run
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

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)); // ""

Parameters

cmd: string
args: string[]