mirror of
https://github.com/denoland/deno.git
synced 2024-11-29 16:30:56 -05:00
Revert "feat(flags): script arguments come after '--'" (#3681)
Due to complaints about ergonomics and because it breaks shebang on
linux.
This reverts commit 2d5457df15
.
BREAKING CHANGE
This commit is contained in:
parent
3eab20ce42
commit
a4dde552de
14 changed files with 82 additions and 78 deletions
34
cli/flags.rs
34
cli/flags.rs
|
@ -485,7 +485,6 @@ fn run_test_args_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) {
|
||||||
fn run_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) {
|
fn run_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) {
|
||||||
flags.subcommand = DenoSubcommand::Run;
|
flags.subcommand = DenoSubcommand::Run;
|
||||||
script_arg_parse(flags, matches);
|
script_arg_parse(flags, matches);
|
||||||
args_parse(flags, matches);
|
|
||||||
run_test_args_parse(flags, matches);
|
run_test_args_parse(flags, matches);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -925,7 +924,6 @@ fn run_subcommand<'a, 'b>() -> App<'a, 'b> {
|
||||||
run_test_args(SubCommand::with_name("run"))
|
run_test_args(SubCommand::with_name("run"))
|
||||||
.setting(AppSettings::TrailingVarArg)
|
.setting(AppSettings::TrailingVarArg)
|
||||||
.arg(script_arg())
|
.arg(script_arg())
|
||||||
.arg(args_arg())
|
|
||||||
.about("Run a program given a filename or url to the source code")
|
.about("Run a program given a filename or url to the source code")
|
||||||
.long_about(
|
.long_about(
|
||||||
"Run a program given a filename or url to the source code.
|
"Run a program given a filename or url to the source code.
|
||||||
|
@ -945,11 +943,7 @@ With only permission to read from disk and listen to network
|
||||||
|
|
||||||
With only permission to read whitelist files from disk
|
With only permission to read whitelist files from disk
|
||||||
|
|
||||||
deno run --allow-read=/etc https://deno.land/std/http/file_server.ts
|
deno run --allow-read=/etc https://deno.land/std/http/file_server.ts",
|
||||||
|
|
||||||
Any arguments that should be passed to the script should be prefixed by '--'
|
|
||||||
|
|
||||||
deno run -A https://deno.land/std/examples/cat.ts -- /etc/passwd",
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -994,26 +988,15 @@ _test.js and executes them.
|
||||||
}
|
}
|
||||||
|
|
||||||
fn script_arg<'a, 'b>() -> Arg<'a, 'b> {
|
fn script_arg<'a, 'b>() -> Arg<'a, 'b> {
|
||||||
Arg::with_name("script").help("script").value_name("SCRIPT")
|
Arg::with_name("script_arg")
|
||||||
|
.multiple(true)
|
||||||
|
.help("script args")
|
||||||
|
.value_name("SCRIPT_ARG")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn script_arg_parse(flags: &mut DenoFlags, matches: &ArgMatches) {
|
fn script_arg_parse(flags: &mut DenoFlags, matches: &ArgMatches) {
|
||||||
if let Some(script_value) = matches.value_of("script") {
|
if let Some(script_values) = matches.values_of("script_arg") {
|
||||||
debug_assert!(flags.argv.len() == 1);
|
for v in script_values {
|
||||||
flags.argv.push(String::from(script_value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn args_arg<'a, 'b>() -> Arg<'a, 'b> {
|
|
||||||
Arg::with_name("script_args")
|
|
||||||
.raw(true)
|
|
||||||
.help("script args")
|
|
||||||
.value_name("SCRIPT_ARGS")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn args_parse(flags: &mut DenoFlags, matches: &ArgMatches) {
|
|
||||||
if let Some(values) = matches.values_of("script_args") {
|
|
||||||
for v in values {
|
|
||||||
flags.argv.push(String::from(v));
|
flags.argv.push(String::from(v));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1341,7 +1324,6 @@ mod tests {
|
||||||
"run",
|
"run",
|
||||||
"--allow-net",
|
"--allow-net",
|
||||||
"gist.ts",
|
"gist.ts",
|
||||||
"--",
|
|
||||||
"--title",
|
"--title",
|
||||||
"X"
|
"X"
|
||||||
]);
|
]);
|
||||||
|
@ -1424,7 +1406,7 @@ mod tests {
|
||||||
r.unwrap(),
|
r.unwrap(),
|
||||||
DenoFlags {
|
DenoFlags {
|
||||||
subcommand: DenoSubcommand::Run,
|
subcommand: DenoSubcommand::Run,
|
||||||
argv: svec!["deno", "script.ts", "-D", "--allow-net"],
|
argv: svec!["deno", "script.ts", "--", "-D", "--allow-net"],
|
||||||
allow_write: true,
|
allow_write: true,
|
||||||
..DenoFlags::default()
|
..DenoFlags::default()
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,7 +253,7 @@ itest!(_027_redirect_typescript {
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(_028_args {
|
itest!(_028_args {
|
||||||
args: "run --reload 028_args.ts -- --arg1 val1 --arg2=val2 -- arg3 arg4",
|
args: "run --reload 028_args.ts --arg1 val1 --arg2=val2 -- arg3 arg4",
|
||||||
output: "028_args.ts.out",
|
output: "028_args.ts.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ mod tests {
|
||||||
.arg("-A")
|
.arg("-A")
|
||||||
// .arg("-Ldebug")
|
// .arg("-Ldebug")
|
||||||
.arg("./testing/runner.ts")
|
.arg("./testing/runner.ts")
|
||||||
.arg("--")
|
|
||||||
.arg("--exclude=testing/testdata")
|
.arg("--exclude=testing/testdata")
|
||||||
.spawn()
|
.spawn()
|
||||||
.expect("failed to spawn script");
|
.expect("failed to spawn script");
|
||||||
|
|
|
@ -20,7 +20,6 @@ test(async function catSmoke(): Promise<void> {
|
||||||
"run",
|
"run",
|
||||||
"--allow-read",
|
"--allow-read",
|
||||||
"examples/cat.ts",
|
"examples/cat.ts",
|
||||||
"--",
|
|
||||||
"README.md"
|
"README.md"
|
||||||
],
|
],
|
||||||
stdout: "piped"
|
stdout: "piped"
|
||||||
|
|
|
@ -217,13 +217,12 @@ test(async function emptyDirPermission(): Promise<void> {
|
||||||
args.push(
|
args.push(
|
||||||
path.join(testdataDir, s.async ? "empty_dir.ts" : "empty_dir_sync.ts")
|
path.join(testdataDir, s.async ? "empty_dir.ts" : "empty_dir_sync.ts")
|
||||||
);
|
);
|
||||||
args.push("--");
|
|
||||||
args.push("testfolder");
|
args.push("testfolder");
|
||||||
|
|
||||||
const { stdout } = Deno.run({
|
const { stdout } = Deno.run({
|
||||||
stdout: "piped",
|
stdout: "piped",
|
||||||
cwd: testdataDir,
|
cwd: testdataDir,
|
||||||
args
|
args: args
|
||||||
});
|
});
|
||||||
|
|
||||||
const output = await Deno.readAll(stdout);
|
const output = await Deno.readAll(stdout);
|
||||||
|
|
|
@ -124,7 +124,6 @@ test(async function existsPermission(): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
args.push(path.join(testdataDir, s.async ? "exists.ts" : "exists_sync.ts"));
|
args.push(path.join(testdataDir, s.async ? "exists.ts" : "exists_sync.ts"));
|
||||||
args.push("--");
|
|
||||||
args.push(s.file);
|
args.push(s.file);
|
||||||
|
|
||||||
const { stdout } = Deno.run({
|
const { stdout } = Deno.run({
|
||||||
|
|
|
@ -14,7 +14,6 @@ async function startFileServer(): Promise<void> {
|
||||||
"--allow-read",
|
"--allow-read",
|
||||||
"--allow-net",
|
"--allow-net",
|
||||||
"http/file_server.ts",
|
"http/file_server.ts",
|
||||||
"--",
|
|
||||||
".",
|
".",
|
||||||
"--cors"
|
"--cors"
|
||||||
],
|
],
|
||||||
|
@ -123,7 +122,7 @@ test(async function servePermissionDenied(): Promise<void> {
|
||||||
|
|
||||||
test(async function printHelp(): Promise<void> {
|
test(async function printHelp(): Promise<void> {
|
||||||
const helpProcess = Deno.run({
|
const helpProcess = Deno.run({
|
||||||
args: [Deno.execPath(), "run", "http/file_server.ts", "--", "--help"],
|
args: [Deno.execPath(), "run", "http/file_server.ts", "--help"],
|
||||||
stdout: "piped"
|
stdout: "piped"
|
||||||
});
|
});
|
||||||
const r = new TextProtoReader(new BufReader(helpProcess.stdout!));
|
const r = new TextProtoReader(new BufReader(helpProcess.stdout!));
|
||||||
|
|
|
@ -255,7 +255,6 @@ export async function install(
|
||||||
"run",
|
"run",
|
||||||
...grantedPermissions.map(getFlagFromPermission),
|
...grantedPermissions.map(getFlagFromPermission),
|
||||||
moduleUrl,
|
moduleUrl,
|
||||||
"--",
|
|
||||||
...scriptArgs
|
...scriptArgs
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
||||||
const { run, stat, makeTempDir, remove, env } = Deno;
|
const { run, stat, makeTempDir, remove, env, readAll } = Deno;
|
||||||
|
|
||||||
import { test, runIfMain, TestFunction } from "../testing/mod.ts";
|
import { test, runIfMain, TestFunction } from "../testing/mod.ts";
|
||||||
import { assert, assertEquals } from "../testing/asserts.ts";
|
import { assert, assertEquals } from "../testing/asserts.ts";
|
||||||
|
@ -20,7 +20,6 @@ async function startFileServer(): Promise<void> {
|
||||||
"--allow-read",
|
"--allow-read",
|
||||||
"--allow-net",
|
"--allow-net",
|
||||||
"http/file_server.ts",
|
"http/file_server.ts",
|
||||||
"--",
|
|
||||||
".",
|
".",
|
||||||
"--cors"
|
"--cors"
|
||||||
],
|
],
|
||||||
|
@ -84,11 +83,11 @@ installerTest(async function installBasic(): Promise<void> {
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
`% This executable is generated by Deno. Please don't modify it unless you know what it means. %
|
`% This executable is generated by Deno. Please don't modify it unless you know what it means. %
|
||||||
@IF EXIST "%~dp0\deno.exe" (
|
@IF EXIST "%~dp0\deno.exe" (
|
||||||
"%~dp0\deno.exe" "run" "http://localhost:4500/installer/testdata/echo.ts" "--" %*
|
"%~dp0\deno.exe" "run" "http://localhost:4500/installer/testdata/echo.ts" %*
|
||||||
) ELSE (
|
) ELSE (
|
||||||
@SETLOCAL
|
@SETLOCAL
|
||||||
@SET PATHEXT=%PATHEXT:;.TS;=;%
|
@SET PATHEXT=%PATHEXT:;.TS;=;%
|
||||||
"deno" "run" "http://localhost:4500/installer/testdata/echo.ts" "--" %*
|
"deno" "run" "http://localhost:4500/installer/testdata/echo.ts" %*
|
||||||
)
|
)
|
||||||
`
|
`
|
||||||
/* eslint-enable max-len */
|
/* eslint-enable max-len */
|
||||||
|
@ -107,10 +106,10 @@ case \`uname\` in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -x "$basedir/deno" ]; then
|
if [ -x "$basedir/deno" ]; then
|
||||||
"$basedir/deno" "run" "http://localhost:4500/installer/testdata/echo.ts" "--" "$@"
|
"$basedir/deno" "run" "http://localhost:4500/installer/testdata/echo.ts" "$@"
|
||||||
ret=$?
|
ret=$?
|
||||||
else
|
else
|
||||||
"deno" "run" "http://localhost:4500/installer/testdata/echo.ts" "--" "$@"
|
"deno" "run" "http://localhost:4500/installer/testdata/echo.ts" "$@"
|
||||||
ret=$?
|
ret=$?
|
||||||
fi
|
fi
|
||||||
exit $ret
|
exit $ret
|
||||||
|
@ -139,11 +138,11 @@ installerTest(async function installCustomDir(): Promise<void> {
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
`% This executable is generated by Deno. Please don't modify it unless you know what it means. %
|
`% This executable is generated by Deno. Please don't modify it unless you know what it means. %
|
||||||
@IF EXIST "%~dp0\deno.exe" (
|
@IF EXIST "%~dp0\deno.exe" (
|
||||||
"%~dp0\deno.exe" "run" "http://localhost:4500/installer/testdata/echo.ts" "--" %*
|
"%~dp0\deno.exe" "run" "http://localhost:4500/installer/testdata/echo.ts" %*
|
||||||
) ELSE (
|
) ELSE (
|
||||||
@SETLOCAL
|
@SETLOCAL
|
||||||
@SET PATHEXT=%PATHEXT:;.TS;=;%
|
@SET PATHEXT=%PATHEXT:;.TS;=;%
|
||||||
"deno" "run" "http://localhost:4500/installer/testdata/echo.ts" "--" %*
|
"deno" "run" "http://localhost:4500/installer/testdata/echo.ts" %*
|
||||||
)
|
)
|
||||||
`
|
`
|
||||||
/* eslint-enable max-len */
|
/* eslint-enable max-len */
|
||||||
|
@ -162,10 +161,10 @@ case \`uname\` in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -x "$basedir/deno" ]; then
|
if [ -x "$basedir/deno" ]; then
|
||||||
"$basedir/deno" "run" "http://localhost:4500/installer/testdata/echo.ts" "--" "$@"
|
"$basedir/deno" "run" "http://localhost:4500/installer/testdata/echo.ts" "$@"
|
||||||
ret=$?
|
ret=$?
|
||||||
else
|
else
|
||||||
"deno" "run" "http://localhost:4500/installer/testdata/echo.ts" "--" "$@"
|
"deno" "run" "http://localhost:4500/installer/testdata/echo.ts" "$@"
|
||||||
ret=$?
|
ret=$?
|
||||||
fi
|
fi
|
||||||
exit $ret
|
exit $ret
|
||||||
|
@ -193,11 +192,11 @@ installerTest(async function installLocalModule(): Promise<void> {
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
`% This executable is generated by Deno. Please don't modify it unless you know what it means. %
|
`% This executable is generated by Deno. Please don't modify it unless you know what it means. %
|
||||||
@IF EXIST "%~dp0\deno.exe" (
|
@IF EXIST "%~dp0\deno.exe" (
|
||||||
"%~dp0\deno.exe" "run" "${localModule}" "--" %*
|
"%~dp0\deno.exe" "run" "${localModule}" %*
|
||||||
) ELSE (
|
) ELSE (
|
||||||
@SETLOCAL
|
@SETLOCAL
|
||||||
@SET PATHEXT=%PATHEXT:;.TS;=;%
|
@SET PATHEXT=%PATHEXT:;.TS;=;%
|
||||||
"deno" "run" "${localModule}" "--" %*
|
"deno" "run" "${localModule}" %*
|
||||||
)
|
)
|
||||||
`
|
`
|
||||||
/* eslint-enable max-len */
|
/* eslint-enable max-len */
|
||||||
|
@ -216,10 +215,10 @@ case \`uname\` in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -x "$basedir/deno" ]; then
|
if [ -x "$basedir/deno" ]; then
|
||||||
"$basedir/deno" "run" "${localModule}" "--" "$@"
|
"$basedir/deno" "run" "${localModule}" "$@"
|
||||||
ret=$?
|
ret=$?
|
||||||
else
|
else
|
||||||
"deno" "run" "${localModule}" "--" "$@"
|
"deno" "run" "${localModule}" "$@"
|
||||||
ret=$?
|
ret=$?
|
||||||
fi
|
fi
|
||||||
exit $ret
|
exit $ret
|
||||||
|
@ -228,17 +227,57 @@ exit $ret
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
/* TODO(ry) Re-enable this test
|
|
||||||
installerTest(async function installWithFlags(): Promise<void> {
|
installerTest(async function installWithFlags(): Promise<void> {
|
||||||
await install(
|
await install(
|
||||||
"echo_test",
|
"echo_test",
|
||||||
"http://localhost:4500/installer/testdata/echo.ts",
|
"http://localhost:4500/installer/testdata/echo.ts",
|
||||||
["--allow-net", "--allow-read", "--foobar"]
|
["--allow-net", "--allow-read", "--foobar"]
|
||||||
);
|
);
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* TODO(ry) Re-enable this test
|
const { HOME } = env();
|
||||||
|
const filePath = path.resolve(HOME, ".deno/bin/echo_test");
|
||||||
|
|
||||||
|
if (path.isWindows) {
|
||||||
|
assertEquals(
|
||||||
|
await fs.readFileStr(filePath + ".cmd"),
|
||||||
|
/* eslint-disable max-len */
|
||||||
|
`% This executable is generated by Deno. Please don't modify it unless you know what it means. %
|
||||||
|
@IF EXIST "%~dp0\deno.exe" (
|
||||||
|
"%~dp0\deno.exe" "run" "--allow-net" "--allow-read" "http://localhost:4500/installer/testdata/echo.ts" "--foobar" %*
|
||||||
|
) ELSE (
|
||||||
|
@SETLOCAL
|
||||||
|
@SET PATHEXT=%PATHEXT:;.TS;=;%
|
||||||
|
"deno" "run" "--allow-net" "--allow-read" "http://localhost:4500/installer/testdata/echo.ts" "--foobar" %*
|
||||||
|
)
|
||||||
|
`
|
||||||
|
/* eslint-enable max-len */
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
assertEquals(
|
||||||
|
await fs.readFileStr(filePath),
|
||||||
|
/* eslint-disable max-len */
|
||||||
|
`#!/bin/sh
|
||||||
|
# This executable is generated by Deno. Please don't modify it unless you know what it means.
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")
|
||||||
|
|
||||||
|
case \`uname\` in
|
||||||
|
*CYGWIN*) basedir=\`cygpath -w "$basedir"\`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/deno" ]; then
|
||||||
|
"$basedir/deno" "run" "--allow-net" "--allow-read" "http://localhost:4500/installer/testdata/echo.ts" "--foobar" "$@"
|
||||||
|
ret=$?
|
||||||
|
else
|
||||||
|
"deno" "run" "--allow-net" "--allow-read" "http://localhost:4500/installer/testdata/echo.ts" "--foobar" "$@"
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
exit $ret
|
||||||
|
`
|
||||||
|
/* eslint-enable max-len */
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
installerTest(async function installLocalModuleAndRun(): Promise<void> {
|
installerTest(async function installLocalModuleAndRun(): Promise<void> {
|
||||||
const tempDir = await makeTempDir();
|
const tempDir = await makeTempDir();
|
||||||
const localModule = path.join(Deno.cwd(), "installer", "testdata", "echo.ts");
|
const localModule = path.join(Deno.cwd(), "installer", "testdata", "echo.ts");
|
||||||
|
@ -276,9 +315,7 @@ installerTest(async function installLocalModuleAndRun(): Promise<void> {
|
||||||
|
|
||||||
assert(!thrown, "It should not throw an error");
|
assert(!thrown, "It should not throw an error");
|
||||||
}, true); // set true to install module in your real $HOME dir.
|
}, true); // set true to install module in your real $HOME dir.
|
||||||
*/
|
|
||||||
|
|
||||||
/* TODO(ry) Re-enable this test
|
|
||||||
installerTest(async function installAndMakesureItCanRun(): Promise<void> {
|
installerTest(async function installAndMakesureItCanRun(): Promise<void> {
|
||||||
const tempDir = await makeTempDir();
|
const tempDir = await makeTempDir();
|
||||||
await install(
|
await install(
|
||||||
|
@ -320,9 +357,7 @@ installerTest(async function installAndMakesureItCanRun(): Promise<void> {
|
||||||
|
|
||||||
assert(!thrown, "It should not throw an error");
|
assert(!thrown, "It should not throw an error");
|
||||||
}, true); // set true to install module in your real $HOME dir.
|
}, true); // set true to install module in your real $HOME dir.
|
||||||
*/
|
|
||||||
|
|
||||||
/* TODO(ry) Re-enable this test
|
|
||||||
installerTest(async function installAndMakesureArgsRight(): Promise<void> {
|
installerTest(async function installAndMakesureArgsRight(): Promise<void> {
|
||||||
const tempDir = await makeTempDir();
|
const tempDir = await makeTempDir();
|
||||||
await install(
|
await install(
|
||||||
|
@ -350,7 +385,9 @@ installerTest(async function installAndMakesureArgsRight(): Promise<void> {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const b = await readAll(ps.stdout);
|
const b = await readAll(ps.stdout);
|
||||||
|
|
||||||
const s = new TextDecoder("utf-8").decode(b);
|
const s = new TextDecoder("utf-8").decode(b);
|
||||||
|
|
||||||
const obj = JSON.parse(s);
|
const obj = JSON.parse(s);
|
||||||
|
|
||||||
assertEquals(obj[0], "arg1");
|
assertEquals(obj[0], "arg1");
|
||||||
|
@ -367,7 +404,6 @@ installerTest(async function installAndMakesureArgsRight(): Promise<void> {
|
||||||
|
|
||||||
assert(!thrown, "It should not throw an error");
|
assert(!thrown, "It should not throw an error");
|
||||||
}, true); // set true to install module in your real $HOME dir.
|
}, true); // set true to install module in your real $HOME dir.
|
||||||
*/
|
|
||||||
|
|
||||||
installerTest(async function installWithoutHOMEVar(): Promise<void> {
|
installerTest(async function installWithoutHOMEVar(): Promise<void> {
|
||||||
const { HOME } = env();
|
const { HOME } = env();
|
||||||
|
@ -391,11 +427,11 @@ installerTest(async function installWithoutHOMEVar(): Promise<void> {
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
`% This executable is generated by Deno. Please don't modify it unless you know what it means. %
|
`% This executable is generated by Deno. Please don't modify it unless you know what it means. %
|
||||||
@IF EXIST "%~dp0\deno.exe" (
|
@IF EXIST "%~dp0\deno.exe" (
|
||||||
"%~dp0\deno.exe" "run" "http://localhost:4500/installer/testdata/echo.ts" "--" %*
|
"%~dp0\deno.exe" "run" "http://localhost:4500/installer/testdata/echo.ts" %*
|
||||||
) ELSE (
|
) ELSE (
|
||||||
@SETLOCAL
|
@SETLOCAL
|
||||||
@SET PATHEXT=%PATHEXT:;.TS;=;%
|
@SET PATHEXT=%PATHEXT:;.TS;=;%
|
||||||
"deno" "run" "http://localhost:4500/installer/testdata/echo.ts" "--" %*
|
"deno" "run" "http://localhost:4500/installer/testdata/echo.ts" %*
|
||||||
)
|
)
|
||||||
`
|
`
|
||||||
/* eslint-enable max-len */
|
/* eslint-enable max-len */
|
||||||
|
@ -414,10 +450,10 @@ case \`uname\` in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -x "$basedir/deno" ]; then
|
if [ -x "$basedir/deno" ]; then
|
||||||
"$basedir/deno" "run" "http://localhost:4500/installer/testdata/echo.ts" "--" "$@"
|
"$basedir/deno" "run" "http://localhost:4500/installer/testdata/echo.ts" "$@"
|
||||||
ret=$?
|
ret=$?
|
||||||
else
|
else
|
||||||
"deno" "run" "http://localhost:4500/installer/testdata/echo.ts" "--" "$@"
|
"deno" "run" "http://localhost:4500/installer/testdata/echo.ts" "$@"
|
||||||
ret=$?
|
ret=$?
|
||||||
fi
|
fi
|
||||||
exit $ret
|
exit $ret
|
||||||
|
|
|
@ -394,7 +394,6 @@ const p = Deno.run({
|
||||||
"run",
|
"run",
|
||||||
"--allow-read",
|
"--allow-read",
|
||||||
"https://deno.land/std/examples/cat.ts",
|
"https://deno.land/std/examples/cat.ts",
|
||||||
"--",
|
|
||||||
...fileNames
|
...fileNames
|
||||||
],
|
],
|
||||||
stdout: "piped",
|
stdout: "piped",
|
||||||
|
|
|
@ -25,8 +25,7 @@ const cmd = [
|
||||||
"--allow-run",
|
"--allow-run",
|
||||||
"--allow-write",
|
"--allow-write",
|
||||||
"--allow-read",
|
"--allow-read",
|
||||||
"./prettier/main.ts",
|
"./prettier/main.ts"
|
||||||
"--"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const testdata = join("prettier", "testdata");
|
const testdata = join("prettier", "testdata");
|
||||||
|
@ -403,7 +402,6 @@ test(async function testPrettierWithAutoConfig(): Promise<void> {
|
||||||
"--allow-read",
|
"--allow-read",
|
||||||
"--allow-env",
|
"--allow-env",
|
||||||
prettierFile,
|
prettierFile,
|
||||||
"--",
|
|
||||||
"../5.ts",
|
"../5.ts",
|
||||||
"--config",
|
"--config",
|
||||||
"auto"
|
"auto"
|
||||||
|
@ -470,7 +468,6 @@ test(async function testPrettierWithSpecifiedConfig(): Promise<void> {
|
||||||
"--allow-read",
|
"--allow-read",
|
||||||
"--allow-env",
|
"--allow-env",
|
||||||
prettierFile,
|
prettierFile,
|
||||||
"--",
|
|
||||||
"../5.ts",
|
"../5.ts",
|
||||||
"--config",
|
"--config",
|
||||||
config.name
|
config.name
|
||||||
|
@ -506,7 +503,6 @@ test(async function testPrettierWithAutoIgnore(): Promise<void> {
|
||||||
"--allow-read",
|
"--allow-read",
|
||||||
"--allow-env",
|
"--allow-env",
|
||||||
prettierFile,
|
prettierFile,
|
||||||
"--",
|
|
||||||
"**/*",
|
"**/*",
|
||||||
"--ignore-path",
|
"--ignore-path",
|
||||||
"auto"
|
"auto"
|
||||||
|
@ -535,7 +531,6 @@ test(async function testPrettierWithSpecifiedIgnore(): Promise<void> {
|
||||||
"--allow-read",
|
"--allow-read",
|
||||||
"--allow-env",
|
"--allow-env",
|
||||||
prettierFile,
|
prettierFile,
|
||||||
"--",
|
|
||||||
"**/*",
|
"**/*",
|
||||||
"--ignore-path",
|
"--ignore-path",
|
||||||
"typescript.prettierignore"
|
"typescript.prettierignore"
|
||||||
|
|
|
@ -26,7 +26,6 @@ fn basic() {
|
||||||
let output = deno_cmd()
|
let output = deno_cmd()
|
||||||
.arg("--allow-plugin")
|
.arg("--allow-plugin")
|
||||||
.arg("tests/test.js")
|
.arg("tests/test.js")
|
||||||
.arg("--")
|
|
||||||
.arg(BUILD_VARIANT)
|
.arg(BUILD_VARIANT)
|
||||||
.output()
|
.output()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -35,7 +35,7 @@ def get_port(port=None):
|
||||||
def deno_tcp(deno_exe):
|
def deno_tcp(deno_exe):
|
||||||
port = get_port()
|
port = get_port()
|
||||||
deno_cmd = [
|
deno_cmd = [
|
||||||
deno_exe, "run", "--allow-net", "tools/deno_tcp.ts", "--",
|
deno_exe, "run", "--allow-net", "tools/deno_tcp.ts",
|
||||||
server_addr(port)
|
server_addr(port)
|
||||||
]
|
]
|
||||||
print "http_benchmark testing DENO tcp."
|
print "http_benchmark testing DENO tcp."
|
||||||
|
@ -46,7 +46,7 @@ def deno_tcp_current_thread(deno_exe):
|
||||||
port = get_port()
|
port = get_port()
|
||||||
deno_cmd = [
|
deno_cmd = [
|
||||||
deno_exe, "run", "--current-thread", "--allow-net",
|
deno_exe, "run", "--current-thread", "--allow-net",
|
||||||
"tools/deno_tcp.ts", "--",
|
"tools/deno_tcp.ts",
|
||||||
server_addr(port)
|
server_addr(port)
|
||||||
]
|
]
|
||||||
print "http_benchmark testing DENO tcp (single-thread)."
|
print "http_benchmark testing DENO tcp (single-thread)."
|
||||||
|
@ -56,7 +56,7 @@ def deno_tcp_current_thread(deno_exe):
|
||||||
def deno_http(deno_exe):
|
def deno_http(deno_exe):
|
||||||
port = get_port()
|
port = get_port()
|
||||||
deno_cmd = [
|
deno_cmd = [
|
||||||
deno_exe, "run", "--allow-net", "std/http/http_bench.ts", "--",
|
deno_exe, "run", "--allow-net", "std/http/http_bench.ts",
|
||||||
server_addr(port)
|
server_addr(port)
|
||||||
]
|
]
|
||||||
print "http_benchmark testing DENO using net/http."
|
print "http_benchmark testing DENO using net/http."
|
||||||
|
@ -67,7 +67,7 @@ def deno_tcp_proxy(deno_exe, hyper_hello_exe):
|
||||||
port = get_port()
|
port = get_port()
|
||||||
origin_port = get_port()
|
origin_port = get_port()
|
||||||
deno_cmd = [
|
deno_cmd = [
|
||||||
deno_exe, "run", "--allow-net", "tools/deno_tcp_proxy.ts", "--",
|
deno_exe, "run", "--allow-net", "tools/deno_tcp_proxy.ts",
|
||||||
server_addr(port),
|
server_addr(port),
|
||||||
server_addr(origin_port)
|
server_addr(origin_port)
|
||||||
]
|
]
|
||||||
|
@ -82,7 +82,7 @@ def deno_http_proxy(deno_exe, hyper_hello_exe):
|
||||||
port = get_port()
|
port = get_port()
|
||||||
origin_port = get_port()
|
origin_port = get_port()
|
||||||
deno_cmd = [
|
deno_cmd = [
|
||||||
deno_exe, "run", "--allow-net", "tools/deno_http_proxy.ts", "--",
|
deno_exe, "run", "--allow-net", "tools/deno_http_proxy.ts",
|
||||||
server_addr(port),
|
server_addr(port),
|
||||||
server_addr(origin_port)
|
server_addr(origin_port)
|
||||||
]
|
]
|
||||||
|
|
|
@ -21,7 +21,7 @@ def cat(deno_exe, megs):
|
||||||
size = megs * MB
|
size = megs * MB
|
||||||
start = time.time()
|
start = time.time()
|
||||||
cmd = deno_exe + " run --allow-read "
|
cmd = deno_exe + " run --allow-read "
|
||||||
cmd += "tests/cat.ts -- /dev/zero | head -c %s " % size
|
cmd += "tests/cat.ts /dev/zero | head -c %s " % size
|
||||||
print cmd
|
print cmd
|
||||||
subprocess.check_output(cmd, shell=True)
|
subprocess.check_output(cmd, shell=True)
|
||||||
end = time.time()
|
end = time.time()
|
||||||
|
@ -32,8 +32,7 @@ def tcp(deno_exe, megs):
|
||||||
size = megs * MB
|
size = megs * MB
|
||||||
# Run deno echo server in the background.
|
# Run deno echo server in the background.
|
||||||
args = [
|
args = [
|
||||||
deno_exe, "run", "--allow-net", "tests/echo_server.ts", "--",
|
deno_exe, "run", "--allow-net", "tests/echo_server.ts", SERVER_ADDR
|
||||||
SERVER_ADDR
|
|
||||||
]
|
]
|
||||||
print args
|
print args
|
||||||
echo_server = subprocess.Popen(args)
|
echo_server = subprocess.Popen(args)
|
||||||
|
|
Loading…
Reference in a new issue