Skip to content

jupegarnica/garn-exec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Garn Exec

A deno utility to run subprocess easily.

$ usage

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
}

cd usage

import { $, cd } from "https://deno.land/x/garn_exec/exec.js";
cd("test");
await $`ls`;

sh usage

import { sh } from "https://deno.land/x/garn_exec/exec.js";
await sh`cd test && ls | grep fail`;