refactor: use spawn API across codebase (#14414)

This commit is contained in:
Leo Kettmeir 2022-05-18 22:00:11 +02:00 committed by GitHub
parent 5ad8919d64
commit 4e1ca1d178
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 266 additions and 327 deletions

View file

@ -31,17 +31,13 @@ export function pathToAbsoluteFileUrl(path: string): URL {
const decoder = new TextDecoder();
export async function execCode(code: string): Promise<[number, string]> {
const p = Deno.run({
cmd: [
Deno.execPath(),
const { status, stdout } = await Deno.spawn(Deno.execPath(), {
args: [
"eval",
"--unstable",
"--no-check",
code,
],
stdout: "piped",
});
const [status, output] = await Promise.all([p.status(), p.output()]);
p.close();
return [status.code, decoder.decode(output)];
return [status.code, decoder.decode(stdout)];
}