diff options
Diffstat (limited to 'utils/run.ts')
-rw-r--r-- | utils/run.ts | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/utils/run.ts b/utils/run.ts deleted file mode 100644 index f06ef97..0000000 --- a/utils/run.ts +++ /dev/null @@ -1,21 +0,0 @@ -export const getStdout = async ( - cmd: string[] | string, - options: Deno.CommandOptions = {}, -): Promise<string> => { - const [exec, ...args] = (typeof cmd === "string") ? cmd.split(" ") : cmd; - const command = new Deno.Command(exec, { - args, - stdout: "piped", - stderr: "piped", - ...options, - }); - - const { code, stdout, stderr } = await command.output(); - - const stdoutText = new TextDecoder().decode(stdout); - const stderrText = new TextDecoder().decode(stderr); - - if (code !== 0) throw new Error(`Command failed\n${stderrText}`); - - return stdoutText; -}; |