Skip to content

Instantly share code, notes, and snippets.

@kawarimidoll
Last active November 26, 2021 16:28
Show Gist options
  • Save kawarimidoll/92179f60dfc67de3b0a52c5eb25ad333 to your computer and use it in GitHub Desktop.
Save kawarimidoll/92179f60dfc67de3b0a52c5eb25ad333 to your computer and use it in GitHub Desktop.
get DENO_DIR
// `--allow-run` permission is required
export async function getDenoDir() {
const p = Deno.run({
cmd: ["deno", "info"],
stdout: "piped",
stderr: "piped",
});
const output = await p.output();
p.close();
return new TextDecoder()
.decode(output)
.split("\n")
.filter((line) => line.includes("DENO_DIR"))[0]
.replace(/^[^"]*"|"$/g, "");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment