Execute and get the output of a shell or bash command in Deno.
Requires the --allow-run
flag.
import { exec } from 'https://cdn.depjs.com/exec/mod.ts'
await exec('deno -V')
// --> deno 1.0.0
await exec(['which', 'deno'])
// --> /usr/local/bin/deno
await exec({
cmd: ['python', '-c', `import os; print(os.environ['ENV_VAR'])`],
cwd: './',
env: {
ENV_VAR: 'cheers'
}
})
// --> cheers
Copyright (c) 2020, Acathur