Migrated silverbullet-publish into this repo

This commit is contained in:
Zef Hemel
2022-11-01 17:03:42 +01:00
parent 3d671e8195
commit c4f80589f3
18 changed files with 567 additions and 18 deletions
+23
View File
@@ -0,0 +1,23 @@
import type { SysCallMapping } from "../system.ts";
export default function (cwd: string): SysCallMapping {
return {
"shell.run": async (
_ctx,
cmd: string,
args: string[],
): Promise<{ stdout: string; stderr: string }> => {
const p = Deno.run({
cmd: [cmd, ...args],
cwd: cwd,
stdout: "piped",
stderr: "piped",
});
await p.status();
const stdout = new TextDecoder().decode(await p.output());
const stderr = new TextDecoder().decode(await p.stderrOutput());
return { stdout, stderr };
},
};
}