| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'package:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 | 7 |
| 8 void openAndWriteScript(String script) { | 8 void openAndWriteScript(String script) { |
| 9 var options = new Options(); | 9 var options = new Options(); |
| 10 var dir = new Path(options.script).directoryPath; | 10 var dir = new Path(options.script).directoryPath; |
| 11 script = "$dir/$script"; | 11 script = "$dir/$script"; |
| 12 var executable = options.executable; | 12 var executable = options.executable; |
| 13 var file = script; // Use script as file. | 13 var file = script; // Use script as file. |
| 14 Process.start("bash", ["-c", "$executable $script < $file"]).then((process) { | 14 Process.start("bash", ["-c", "$executable $script < $file"]).then((process) { |
| 15 process.exitCode | 15 process.exitCode |
| 16 .then((exitCode) { | 16 .then((exitCode) { |
| 17 Expect.equals(0, exitCode); | 17 Expect.equals(0, exitCode); |
| 18 }); | 18 }); |
| 19 }); | 19 }); |
| 20 } | 20 } |
| 21 | 21 |
| 22 void testReadStdio() { | 22 void testReadStdio() { |
| 23 openAndWriteScript("file_read_stdio_script.dart"); | 23 openAndWriteScript("file_read_stdio_script.dart"); |
| 24 } | 24 } |
| 25 | 25 |
| 26 void main() { | 26 void main() { |
| 27 testReadStdio(); | 27 // Special unix devices do not exist on Windows. |
| 28 if (Platform.operatingSystem != 'windows') { |
| 29 testReadStdio(); |
| 30 } |
| 28 } | 31 } |
| OLD | NEW |