OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 'dart:io'; | 5 import 'dart:io'; |
6 import 'dart:isolate'; | 6 import 'dart:isolate'; |
7 | 7 |
8 main() { | 8 main() { |
9 var port = new ReceivePort(); | 9 var port = new ReceivePort(); |
10 var executable = new File(new Options().executable).fullPathSync(); | 10 var executable = new File(new Options().executable).fullPathSync(); |
11 var tempDir = new Directory('').createTempSync(); | 11 var tempDir = new Directory('').createTempSync(); |
12 var nonAsciiDir = new Directory('${tempDir.path}/æøå'); | 12 var nonAsciiDir = new Directory('${tempDir.path}/æøå'); |
13 nonAsciiDir.createSync(); | 13 nonAsciiDir.createSync(); |
14 var nonAsciiFile = new File('${nonAsciiDir.path}/æøå.dart'); | 14 var nonAsciiFile = new File('${nonAsciiDir.path}/æøå.dart'); |
15 var opened = nonAsciiFile.openSync(FileMode.WRITE); | 15 nonAsciiFile.writeAsStringSync( |
16 opened.writeStringSync( | |
17 """ | 16 """ |
18 import 'dart:io'; | 17 import 'dart:io'; |
19 | 18 |
20 main() { | 19 main() { |
21 Expect.equals('æøå', new File('æøå.txt').readAsStringSync()); | 20 Expect.equals('æøå', new File('æøå.txt').readAsStringSync()); |
22 } | 21 } |
23 """); | 22 """); |
24 opened.closeSync(); | |
25 var nonAsciiTxtFile = new File('${nonAsciiDir.path}/æøå.txt'); | 23 var nonAsciiTxtFile = new File('${nonAsciiDir.path}/æøå.txt'); |
26 opened = nonAsciiTxtFile.openSync(FileMode.WRITE); | 24 nonAsciiTxtFile.writeAsStringSync('æøå'); |
27 opened.writeStringSync('æøå'); | |
28 opened.closeSync(); | |
29 var options = new ProcessOptions(); | 25 var options = new ProcessOptions(); |
30 options.workingDirectory = nonAsciiDir.path; | 26 options.workingDirectory = nonAsciiDir.path; |
31 var script = nonAsciiFile.name; | 27 var script = nonAsciiFile.name; |
32 Process.run(executable, [script], options).then((result) { | 28 Process.run(executable, [script], options).then((result) { |
33 Expect.equals(0, result.exitCode); | 29 Expect.equals(0, result.exitCode); |
34 tempDir.deleteSync(recursive: true); | 30 tempDir.deleteSync(recursive: true); |
35 port.close(); | 31 port.close(); |
36 }); | 32 }); |
37 } | 33 } |
OLD | NEW |