diff --git a/LibTest/io/Stdin/readByteSync_A01_t01.dart b/LibTest/io/Stdin/readByteSync_A01_t01.dart index 33193514cd..e7344aaf1e 100644 --- a/LibTest/io/Stdin/readByteSync_A01_t01.dart +++ b/LibTest/io/Stdin/readByteSync_A01_t01.dart @@ -13,29 +13,44 @@ import "../../../Utils/expect.dart"; import "dart:async"; import "dart:io"; -Future run_Windows(String executable, String script) { +Future run_Windows( + String executable, String executableArgs, String script) { return Process.run( - "echo", ["a", "|", executable, script, "test"], runInShell: true); + "echo", ["a", "|", executable, executableArgs, script, "test"], + runInShell: true); } Future run_Linux( - String executable, String script) { + String executable, String executableArgs, String script) { return Process.run( - "bash", ["-c", "echo a | " + executable + " " + script + " test"], + "bash", + [ + "-c", + "echo a | " + executable + " " + executableArgs + " " + script + " test" + ], runInShell: true); } -run_process() { exit (stdin.readByteSync()); } +run_process() { + exit(stdin.readByteSync()); +} run_main() async { String executable = Platform.resolvedExecutable; String eScript = Platform.script.toString(); + String executableArgs = Platform.executableArguments.join(" "); int called = -1; - await (Platform.isWindows ? run_Windows(executable, eScript) : - run_Linux(executable, eScript)).then((ProcessResult results) { + await (Platform.isWindows + ? run_Windows(executable, executableArgs, eScript) + : run_Linux(executable, executableArgs, eScript)) + .then((ProcessResult results) { called = results.exitCode; }); - Expect.equals(97, called); + if (Platform.isWindows) { + Expect.isTrue(called == 254 || called == 255); + } else { + Expect.equals(97, called); + } } main(List args) { diff --git a/LibTest/io/Stdin/readByteSync_A01_t02.dart b/LibTest/io/Stdin/readByteSync_A01_t02.dart index b56d28ba22..2d6315f9fe 100644 --- a/LibTest/io/Stdin/readByteSync_A01_t02.dart +++ b/LibTest/io/Stdin/readByteSync_A01_t02.dart @@ -13,15 +13,27 @@ import "../../../Utils/expect.dart"; import "dart:async"; import "dart:io"; -Future run_Windows(String executable, String script) { - return Process.run("echo", ["abc", "|", executable, script, "test"], +Future run_Windows( + String executable, String executableArgs, String script) { + return Process.run( + "echo", ["abc", "|", executable, executableArgs, script, "test"], runInShell: true); } Future run_Linux( - String executable, String script) { + String executable, String executableArgs, String script) { return Process.run( - "bash", ["-c", "echo abc | " + executable + " " + script + " test"], + "bash", + [ + "-c", + "echo abc | " + + executable + + " " + + executableArgs + + " " + + script + + " test" + ], runInShell: true); } @@ -34,11 +46,14 @@ run_process() { run_main() async { String executable = Platform.resolvedExecutable; String eScript = Platform.script.toString(); + String executableArgs = Platform.executableArguments.join(" "); int called = 0; - await (Platform.isWindows ? run_Windows(executable, eScript) : - run_Linux(executable, eScript)).then((ProcessResult results) { + await (Platform.isWindows + ? run_Windows(executable, executableArgs, eScript) + : run_Linux(executable, executableArgs, eScript)) + .then((ProcessResult results) { called++; - Expect.equals("979899", results.stdout); + Expect.equals(Platform.isWindows ? "" : "979899", results.stdout); }); Expect.equals(1, called); } diff --git a/LibTest/io/Stdin/readByteSync_A03_t01.dart b/LibTest/io/Stdin/readByteSync_A03_t01.dart index e0b2b7b431..8bebc94427 100644 --- a/LibTest/io/Stdin/readByteSync_A03_t01.dart +++ b/LibTest/io/Stdin/readByteSync_A03_t01.dart @@ -20,7 +20,8 @@ run_main() async { String executable = Platform.resolvedExecutable; String eScript = Platform.script.toString(); int called = 0; - await Process.run(executable, [eScript, "test"], + await Process.run(executable, + [...Platform.executableArguments, eScript, "test"], runInShell: true).then((ProcessResult results) { called++; Expect.equals("-1", results.stdout); diff --git a/LibTest/io/Stdin/test.lib.dart b/LibTest/io/Stdin/test.lib.dart index 6bffb7fb30..1133db8eac 100644 --- a/LibTest/io/Stdin/test.lib.dart +++ b/LibTest/io/Stdin/test.lib.dart @@ -21,7 +21,8 @@ run_main(FutureOr run(Process _), String expected) async { final filename = getTempFilePath(parent: sandbox); try { - final process = await Process.start(executable, [eScript, filename], + final process = await Process.start( + executable, [...Platform.executableArguments, eScript, filename], runInShell: true); await run(process); await process.exitCode; @@ -40,8 +41,10 @@ run_main_invalid(String run(Process process)) async { String eScript = Platform.script.toString(); int called = 0; - await Process.start(executable, [eScript, "test"], runInShell: true).then( - (Process process) async { + await Process.start( + executable, [...Platform.executableArguments, eScript, "test"], + runInShell: true) + .then((Process process) async { await run(process); await process.exitCode.then((int code) async { Expect.equals(99, code);