summaryrefslogtreecommitdiff
path: root/cli/js
diff options
context:
space:
mode:
Diffstat (limited to 'cli/js')
-rw-r--r--cli/js/lib.deno.ns.d.ts4
-rw-r--r--cli/js/ops/process.ts4
-rw-r--r--cli/js/process.ts6
-rw-r--r--cli/js/tests/chown_test.ts4
-rw-r--r--cli/js/tests/os_test.ts2
-rw-r--r--cli/js/tests/process_test.ts34
-rwxr-xr-xcli/js/tests/unit_test_runner.ts8
7 files changed, 31 insertions, 31 deletions
diff --git a/cli/js/lib.deno.ns.d.ts b/cli/js/lib.deno.ns.d.ts
index 4a7609920..dd32162ef 100644
--- a/cli/js/lib.deno.ns.d.ts
+++ b/cli/js/lib.deno.ns.d.ts
@@ -1900,12 +1900,12 @@ declare namespace Deno {
signal?: number;
}
- /** **UNSTABLE**: Maybe rename `args` to `argv` to differentiate from
+ /** **UNSTABLE**: `args` has been recently renamed to `cmd` to differentiate from
* `Deno.args`. */
export interface RunOptions {
/** Arguments to pass. Note, the first element needs to be a path to the
* binary */
- args: string[];
+ cmd: string[];
cwd?: string;
env?: {
[key: string]: string;
diff --git a/cli/js/ops/process.ts b/cli/js/ops/process.ts
index 384718cef..39c6eb8b7 100644
--- a/cli/js/ops/process.ts
+++ b/cli/js/ops/process.ts
@@ -17,7 +17,7 @@ export function runStatus(rid: number): Promise<RunStatusResponse> {
}
interface RunRequest {
- args: string[];
+ cmd: string[];
cwd?: string;
env?: Array<[string, string]>;
stdin: string;
@@ -37,6 +37,6 @@ interface RunResponse {
}
export function run(request: RunRequest): RunResponse {
- assert(request.args.length > 0);
+ assert(request.cmd.length > 0);
return sendSync("op_run", request);
}
diff --git a/cli/js/process.ts b/cli/js/process.ts
index ded1458a2..057e97f11 100644
--- a/cli/js/process.ts
+++ b/cli/js/process.ts
@@ -10,7 +10,7 @@ export type ProcessStdio = "inherit" | "piped" | "null";
// TODO Maybe extend VSCode's 'CommandOptions'?
// See https://code.visualstudio.com/docs/editor/tasks-appendix#_schema-for-tasksjson
export interface RunOptions {
- args: string[];
+ cmd: string[];
cwd?: string;
env?: { [key: string]: string };
stdout?: ProcessStdio | number;
@@ -108,7 +108,7 @@ interface RunResponse {
stderrRid: number | null;
}
export function run({
- args,
+ cmd,
cwd = undefined,
env = {},
stdout = "inherit",
@@ -116,7 +116,7 @@ export function run({
stdin = "inherit"
}: RunOptions): Process {
const res = runOp({
- args: args.map(String),
+ cmd: cmd.map(String),
cwd,
env: Object.entries(env),
stdin: isRid(stdin) ? "" : stdin,
diff --git a/cli/js/tests/chown_test.ts b/cli/js/tests/chown_test.ts
index 50dcd6dc1..f1847a08c 100644
--- a/cli/js/tests/chown_test.ts
+++ b/cli/js/tests/chown_test.ts
@@ -7,11 +7,11 @@ if (Deno.build.os !== "win") {
// get the user ID and group ID of the current process
const uidProc = Deno.run({
stdout: "piped",
- args: ["python", "-c", "import os; print(os.getuid())"]
+ cmd: ["python", "-c", "import os; print(os.getuid())"]
});
const gidProc = Deno.run({
stdout: "piped",
- args: ["python", "-c", "import os; print(os.getgid())"]
+ cmd: ["python", "-c", "import os; print(os.getgid())"]
});
assertEquals((await uidProc.status()).code, 0);
diff --git a/cli/js/tests/os_test.ts b/cli/js/tests/os_test.ts
index bc1766a2b..ef45d36fe 100644
--- a/cli/js/tests/os_test.ts
+++ b/cli/js/tests/os_test.ts
@@ -65,7 +65,7 @@ unitTest(
${JSON.stringify(Object.keys(expectedEnv))}.map(k => Deno.env(k))
)`;
const proc = Deno.run({
- args: [Deno.execPath(), "eval", src],
+ cmd: [Deno.execPath(), "eval", src],
env: inputEnv,
stdout: "piped"
});
diff --git a/cli/js/tests/process_test.ts b/cli/js/tests/process_test.ts
index e2da6cab5..216b8a3bd 100644
--- a/cli/js/tests/process_test.ts
+++ b/cli/js/tests/process_test.ts
@@ -10,7 +10,7 @@ const { kill, run, readFile, open, makeTempDir, writeFile } = Deno;
unitTest(function runPermissions(): void {
let caughtError = false;
try {
- Deno.run({ args: ["python", "-c", "print('hello world')"] });
+ Deno.run({ cmd: ["python", "-c", "print('hello world')"] });
} catch (e) {
caughtError = true;
assert(e instanceof Deno.errors.PermissionDenied);
@@ -20,7 +20,7 @@ unitTest(function runPermissions(): void {
unitTest({ perms: { run: true } }, async function runSuccess(): Promise<void> {
const p = run({
- args: ["python", "-c", "print('hello world')"],
+ cmd: ["python", "-c", "print('hello world')"],
stdout: "piped",
stderr: "null"
});
@@ -36,7 +36,7 @@ unitTest(
{ perms: { run: true } },
async function runCommandFailedWithCode(): Promise<void> {
const p = run({
- args: ["python", "-c", "import sys;sys.exit(41 + 1)"]
+ cmd: ["python", "-c", "import sys;sys.exit(41 + 1)"]
});
const status = await p.status();
assertEquals(status.success, false);
@@ -54,7 +54,7 @@ unitTest(
},
async function runCommandFailedWithSignal(): Promise<void> {
const p = run({
- args: ["python", "-c", "import os;os.kill(os.getpid(), 9)"]
+ cmd: ["python", "-c", "import os;os.kill(os.getpid(), 9)"]
});
const status = await p.status();
assertEquals(status.success, false);
@@ -67,7 +67,7 @@ unitTest(
unitTest({ perms: { run: true } }, function runNotFound(): void {
let error;
try {
- run({ args: ["this file hopefully doesn't exist"] });
+ run({ cmd: ["this file hopefully doesn't exist"] });
} catch (e) {
error = e;
}
@@ -102,7 +102,7 @@ while True:
Deno.writeFileSync(`${cwd}/${pyProgramFile}.py`, enc.encode(pyProgram));
const p = run({
cwd,
- args: ["python", `${pyProgramFile}.py`]
+ cmd: ["python", `${pyProgramFile}.py`]
});
// Write the expected exit code *after* starting python.
@@ -122,7 +122,7 @@ unitTest({ perms: { run: true } }, async function runStdinPiped(): Promise<
void
> {
const p = run({
- args: ["python", "-c", "import sys; assert 'hello' == sys.stdin.read();"],
+ cmd: ["python", "-c", "import sys; assert 'hello' == sys.stdin.read();"],
stdin: "piped"
});
assert(p.stdin);
@@ -146,7 +146,7 @@ unitTest({ perms: { run: true } }, async function runStdoutPiped(): Promise<
void
> {
const p = run({
- args: ["python", "-c", "import sys; sys.stdout.write('hello')"],
+ cmd: ["python", "-c", "import sys; sys.stdout.write('hello')"],
stdout: "piped"
});
assert(!p.stdin);
@@ -175,7 +175,7 @@ unitTest({ perms: { run: true } }, async function runStderrPiped(): Promise<
void
> {
const p = run({
- args: ["python", "-c", "import sys; sys.stderr.write('hello')"],
+ cmd: ["python", "-c", "import sys; sys.stderr.write('hello')"],
stderr: "piped"
});
assert(!p.stdin);
@@ -202,7 +202,7 @@ unitTest({ perms: { run: true } }, async function runStderrPiped(): Promise<
unitTest({ perms: { run: true } }, async function runOutput(): Promise<void> {
const p = run({
- args: ["python", "-c", "import sys; sys.stdout.write('hello')"],
+ cmd: ["python", "-c", "import sys; sys.stdout.write('hello')"],
stdout: "piped"
});
const output = await p.output();
@@ -215,7 +215,7 @@ unitTest({ perms: { run: true } }, async function runStderrOutput(): Promise<
void
> {
const p = run({
- args: ["python", "-c", "import sys; sys.stderr.write('error')"],
+ cmd: ["python", "-c", "import sys; sys.stderr.write('error')"],
stderr: "piped"
});
const error = await p.stderrOutput();
@@ -232,7 +232,7 @@ unitTest(
const file = await open(fileName, "w");
const p = run({
- args: [
+ cmd: [
"python",
"-c",
"import sys; sys.stderr.write('error\\n'); sys.stdout.write('output\\n');"
@@ -264,7 +264,7 @@ unitTest(
const file = await open(fileName, "r");
const p = run({
- args: ["python", "-c", "import sys; assert 'hello' == sys.stdin.read();"],
+ cmd: ["python", "-c", "import sys; assert 'hello' == sys.stdin.read();"],
stdin: file.rid
});
@@ -277,7 +277,7 @@ unitTest(
unitTest({ perms: { run: true } }, async function runEnv(): Promise<void> {
const p = run({
- args: [
+ cmd: [
"python",
"-c",
"import os, sys; sys.stdout.write(os.environ.get('FOO', '') + os.environ.get('BAR', ''))"
@@ -296,7 +296,7 @@ unitTest({ perms: { run: true } }, async function runEnv(): Promise<void> {
unitTest({ perms: { run: true } }, async function runClose(): Promise<void> {
const p = run({
- args: [
+ cmd: [
"python",
"-c",
"from time import sleep; import sys; sleep(10000); sys.stderr.write('error')"
@@ -343,7 +343,7 @@ if (Deno.build.os !== "win") {
void
> {
const p = run({
- args: ["python", "-c", "from time import sleep; sleep(10000)"]
+ cmd: ["python", "-c", "from time import sleep; sleep(10000)"]
});
assertEquals(Deno.Signal.SIGINT, 2);
@@ -361,7 +361,7 @@ if (Deno.build.os !== "win") {
unitTest({ perms: { run: true } }, function killFailed(): void {
const p = run({
- args: ["python", "-c", "from time import sleep; sleep(10000)"]
+ cmd: ["python", "-c", "from time import sleep; sleep(10000)"]
});
assert(!p.stdin);
assert(!p.stdout);
diff --git a/cli/js/tests/unit_test_runner.ts b/cli/js/tests/unit_test_runner.ts
index 62c3250a7..e79e1b7ea 100755
--- a/cli/js/tests/unit_test_runner.ts
+++ b/cli/js/tests/unit_test_runner.ts
@@ -86,7 +86,7 @@ function spawnWorkerRunner(
})
.join(",");
- const args = [
+ const cmd = [
Deno.execPath(),
"run",
"-A",
@@ -97,14 +97,14 @@ function spawnWorkerRunner(
];
if (filter) {
- args.push("--");
- args.push(filter);
+ cmd.push("--");
+ cmd.push(filter);
}
const ioMode = verbose ? "inherit" : "null";
const p = Deno.run({
- args,
+ cmd,
stdin: ioMode,
stdout: ioMode,
stderr: ioMode