1
0
silverbullet/server/syscalls/shell.ts

16 lines
373 B
TypeScript
Raw Normal View History

2022-03-21 14:21:34 +00:00
import { promisify } from "util";
import { execFile } from "child_process";
const execFilePromise = promisify(execFile);
export default function (cwd: string) {
return {
"shell.run": async (cmd: string, args: string[]) => {
let { stdout, stderr } = await execFilePromise(cmd, args, {
cwd: cwd,
});
return { stdout, stderr };
},
};
}