1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-11 16:42:21 -05:00

installer: quote commands correctly (denoland/deno_std#510)

Original: 4317af11d1
This commit is contained in:
Axetroy 2019-06-19 22:16:34 +08:00 committed by Ryan Dahl
parent 57edeacaa5
commit 33ffb89f5c
2 changed files with 9 additions and 8 deletions

View file

@ -153,6 +153,7 @@ async function generateExecutable(
filePath: string, filePath: string,
commands: string[] commands: string[]
): Promise<void> { ): Promise<void> {
commands = commands.map((v): string => JSON.stringify(v));
// On Windows if user is using Powershell .cmd extension is need to run the // On Windows if user is using Powershell .cmd extension is need to run the
// installed module. // installed module.
// Generate batch script to satisfy that. // Generate batch script to satisfy that.

View file

@ -71,11 +71,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/http/file_server.ts %* "%~dp0\deno.exe" "run" "http://localhost:4500/http/file_server.ts" %*
) ELSE ( ) ELSE (
@SETLOCAL @SETLOCAL
@SET PATHEXT=%PATHEXT:;.TS;=;% @SET PATHEXT=%PATHEXT:;.TS;=;%
deno run http://localhost:4500/http/file_server.ts %* "deno" "run" "http://localhost:4500/http/file_server.ts" %*
) )
` `
/* eslint-enable max-len */ /* eslint-enable max-len */
@ -94,10 +94,10 @@ case \`uname\` in
esac esac
if [ -x "$basedir/deno" ]; then if [ -x "$basedir/deno" ]; then
"$basedir/deno" run http://localhost:4500/http/file_server.ts "$@" "$basedir/deno" "run" "http://localhost:4500/http/file_server.ts" "$@"
ret=$? ret=$?
else else
deno run http://localhost:4500/http/file_server.ts "$@" "deno" "run" "http://localhost:4500/http/file_server.ts" "$@"
ret=$? ret=$?
fi fi
exit $ret exit $ret
@ -122,11 +122,11 @@ installerTest(async function installWithFlags(): 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 --allow-net --allow-read http://localhost:4500/http/file_server.ts --foobar %* "%~dp0\deno.exe" "run" "--allow-net" "--allow-read" "http://localhost:4500/http/file_server.ts" "--foobar" %*
) ELSE ( ) ELSE (
@SETLOCAL @SETLOCAL
@SET PATHEXT=%PATHEXT:;.TS;=;% @SET PATHEXT=%PATHEXT:;.TS;=;%
deno run --allow-net --allow-read http://localhost:4500/http/file_server.ts --foobar %* "deno" "run" "--allow-net" "--allow-read" "http://localhost:4500/http/file_server.ts" "--foobar" %*
) )
` `
/* eslint-enable max-len */ /* eslint-enable max-len */
@ -145,10 +145,10 @@ case \`uname\` in
esac esac
if [ -x "$basedir/deno" ]; then if [ -x "$basedir/deno" ]; then
"$basedir/deno" run --allow-net --allow-read http://localhost:4500/http/file_server.ts --foobar "$@" "$basedir/deno" "run" "--allow-net" "--allow-read" "http://localhost:4500/http/file_server.ts" "--foobar" "$@"
ret=$? ret=$?
else else
deno run --allow-net --allow-read http://localhost:4500/http/file_server.ts --foobar "$@" "deno" "run" "--allow-net" "--allow-read" "http://localhost:4500/http/file_server.ts" "--foobar" "$@"
ret=$? ret=$?
fi fi
exit $ret exit $ret