Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use execPath where appropriate #255

Merged
merged 1 commit into from Mar 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions format.ts
@@ -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",
Expand Down
6 changes: 3 additions & 3 deletions prettier/main_test.ts
Expand Up @@ -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();

Expand All @@ -19,7 +19,7 @@ async function run(
}

const cmd = [
`deno${executableSuffix}`,
execPath,
"--allow-run",
"--allow-write",
"--allow-read",
Expand Down
2 changes: 0 additions & 2 deletions prettier/util.ts
Expand Up @@ -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" : "";