A deno utility to run subprocess easily.
Must be run --allow-run permission.
import { $ } from "https://deno.land/x/garn_exec/exec.js";
await $`cp *.js ..`;
import { $ } from "https://deno.land/x/garn_exec/exec.js";
const { stdout, code } = await $`echo hola mundo`;
console.log(stdout); // hola mundo\n
console.log(code); // 0
import { $ } from "https://deno.land/x/garn_exec/exec.js";
try {
await $`sh test/fail.sh`;
} catch (error) {
console.log(error.code); // 4
}
import { $, cd } from "https://deno.land/x/garn_exec/exec.js";
cd("test");
await $`ls`;
import { sh } from "https://deno.land/x/garn_exec/exec.js";
await sh`cd test && ls | grep fail`;