1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-27 01:29:14 -05:00

refactor: use execPath where appropriate (#255)

This commit is contained in:
Yoshiya Hinosawa 2019-03-09 02:41:47 +09:00 committed by Ryan Dahl
parent 02274ef48b
commit bf76484301
3 changed files with 6 additions and 8 deletions

View file

@ -1,12 +1,12 @@
#!/usr/bin/env deno --allow-run --allow-write --allow-read #!/usr/bin/env deno --allow-run --allow-write --allow-read
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
const { exit, args } = Deno; const { exit, args, execPath } = Deno;
import { parse } from "./flags/mod.ts"; import { parse } from "./flags/mod.ts";
import { xrun, executableSuffix } from "./prettier/util.ts"; import { xrun } from "./prettier/util.ts";
async function main(opts) { async function main(opts) {
const args = [ const args = [
`deno${executableSuffix}`, execPath,
"--allow-write", "--allow-write",
"--allow-read", "--allow-read",
"prettier/main.ts", "prettier/main.ts",

View file

@ -2,8 +2,8 @@
import { join } from "../fs/path.ts"; import { join } from "../fs/path.ts";
import { assertEquals } from "../testing/asserts.ts"; import { assertEquals } from "../testing/asserts.ts";
import { test } from "../testing/mod.ts"; import { test } from "../testing/mod.ts";
import { xrun, executableSuffix } from "./util.ts"; import { xrun } from "./util.ts";
const { readAll } = Deno; const { readAll, execPath } = Deno;
const decoder = new TextDecoder(); const decoder = new TextDecoder();
@ -19,7 +19,7 @@ async function run(
} }
const cmd = [ const cmd = [
`deno${executableSuffix}`, execPath,
"--allow-run", "--allow-run",
"--allow-write", "--allow-write",
"--allow-read", "--allow-read",

View file

@ -8,5 +8,3 @@ export function xrun(opts): Deno.Process {
args: build.os === "win" ? ["cmd.exe", "/c", ...opts.args] : opts.args args: build.os === "win" ? ["cmd.exe", "/c", ...opts.args] : opts.args
}); });
} }
export const executableSuffix = build.os === "win" ? ".exe" : "";