diff options
| author | Yoshiya Hinosawa <stibium121@gmail.com> | 2019-03-09 02:41:47 +0900 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2019-03-08 12:41:47 -0500 |
| commit | 0434076ea6ab4abf0673d99feaa13768a2e1e7c8 (patch) | |
| tree | f462561a31063aeeecab9251a051b93c4d1722dc | |
| parent | b7a11b486d41de9b2a61225aa211f58cf6d36b88 (diff) | |
refactor: use execPath where appropriate (denoland/deno_std#255)
Original: https://github.com/denoland/deno_std/commit/bf76484301cccbc857cdf205a44762239392ebed
| -rwxr-xr-x | format.ts | 6 | ||||
| -rw-r--r-- | prettier/main_test.ts | 6 | ||||
| -rw-r--r-- | prettier/util.ts | 2 |
3 files changed, 6 insertions, 8 deletions
@@ -1,12 +1,12 @@ #!/usr/bin/env deno --allow-run --allow-write --allow-read // 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 { xrun, executableSuffix } from "./prettier/util.ts"; +import { xrun } from "./prettier/util.ts"; async function main(opts) { const args = [ - `deno${executableSuffix}`, + execPath, "--allow-write", "--allow-read", "prettier/main.ts", diff --git a/prettier/main_test.ts b/prettier/main_test.ts index ed2274a6b..718b716af 100644 --- a/prettier/main_test.ts +++ b/prettier/main_test.ts @@ -2,8 +2,8 @@ import { join } from "../fs/path.ts"; import { assertEquals } from "../testing/asserts.ts"; import { test } from "../testing/mod.ts"; -import { xrun, executableSuffix } from "./util.ts"; -const { readAll } = Deno; +import { xrun } from "./util.ts"; +const { readAll, execPath } = Deno; const decoder = new TextDecoder(); @@ -19,7 +19,7 @@ async function run( } const cmd = [ - `deno${executableSuffix}`, + execPath, "--allow-run", "--allow-write", "--allow-read", diff --git a/prettier/util.ts b/prettier/util.ts index abbf5a993..1c5513c8d 100644 --- a/prettier/util.ts +++ b/prettier/util.ts @@ -8,5 +8,3 @@ export function xrun(opts): Deno.Process { args: build.os === "win" ? ["cmd.exe", "/c", ...opts.args] : opts.args }); } - -export const executableSuffix = build.os === "win" ? ".exe" : ""; |
