mirror of
https://github.com/denoland/deno.git
synced 2024-11-23 15:16:54 -05:00
refactor: use execPath where appropriate (denoland/deno_std#255)
Original: bf76484301
This commit is contained in:
parent
b7a11b486d
commit
0434076ea6
3 changed files with 6 additions and 8 deletions
|
@ -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",
|
||||||
|
|
|
@ -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",
|
||||||
|
|
|
@ -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" : "";
|
|
||||||
|
|
Loading…
Reference in a new issue