| 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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 import 'dart:isolate'; | 7 import 'dart:isolate'; |
| 8 | 8 |
| 9 main() { | 9 main() { |
| 10 var port = new ReceivePort(); | 10 var port = new ReceivePort(); |
| 11 var executable = new File(new Options().executable).fullPathSync(); | 11 var executable = new File(new Options().executable).fullPathSync(); |
| 12 var tempDir = new Directory('').createTempSync(); | 12 var tempDir = new Directory('').createTempSync(); |
| 13 var nonAsciiDir = new Directory('${tempDir.path}/æøå'); | 13 var nonAsciiDir = new Directory('${tempDir.path}/æøå'); |
| 14 nonAsciiDir.createSync(); | 14 nonAsciiDir.createSync(); |
| 15 var nonAsciiFile = new File('${nonAsciiDir.path}/æøå.dart'); | 15 var nonAsciiFile = new File('${nonAsciiDir.path}/æøå.dart'); |
| 16 nonAsciiFile.writeAsStringSync( | 16 nonAsciiFile.writeAsStringSync( |
| 17 """ | 17 """ |
| 18 import 'dart:io'; | 18 import 'dart:io'; |
| 19 | 19 |
| 20 main() { | 20 main() { |
| 21 if ('æøå' != new File('æøå.txt').readAsStringSync()) { | 21 if ('æøå' != new File('æøå.txt').readAsStringSync()) { |
| 22 throw new RuntimeError("not equal"); | 22 throw new RuntimeError("not equal"); |
| 23 } | 23 } |
| 24 } | 24 } |
| 25 """); | 25 """); |
| 26 var nonAsciiTxtFile = new File('${nonAsciiDir.path}/æøå.txt'); | 26 var nonAsciiTxtFile = new File('${nonAsciiDir.path}/æøå.txt'); |
| 27 nonAsciiTxtFile.writeAsStringSync('æøå'); | 27 nonAsciiTxtFile.writeAsStringSync('æøå'); |
| 28 var options = new ProcessOptions(); | |
| 29 options.workingDirectory = nonAsciiDir.path; | |
| 30 var script = nonAsciiFile.path; | 28 var script = nonAsciiFile.path; |
| 31 Process.run(executable, [script], options).then((result) { | 29 Process.run(executable, [script], workingDirectory: nonAsciiDir.path) |
| 32 Expect.equals(0, result.exitCode); | 30 .then((result) { |
| 33 tempDir.deleteSync(recursive: true); | 31 Expect.equals(0, result.exitCode); |
| 34 port.close(); | 32 tempDir.deleteSync(recursive: true); |
| 35 }); | 33 port.close(); |
| 34 }); |
| 36 } | 35 } |
| OLD | NEW |