🦅 Execute command in a child process
UNLICENSE License
import { execute } from "async-execute";
const commit_message = await execute("git log -1 --pretty=%B"); // Committed some changes
await execute("npm t", { pipe: true });
await execute("npm t", { pipe: true, exit: true });
let code = 0;
try {
const result = await execute("exit 2");
code = result.code;
} catch (error) {
code = error.code;
}
if (code > 0) {
// something must have gone wrong
}
await execute("echo $API_KEY", {
env: { API_KEY: "vQQNJe7lnz4rTbYvr61VywR0wRlRzCyI" },
});
await execute("pwd", { cwd: "~/app" });