| 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 // Regression test for http://dartbug.com/7191. | 5 // Regression test for http://dartbug.com/7191. |
| 6 | 6 |
| 7 // Starts a sub-process which in turn starts another sub-process and then closes | 7 // Starts a sub-process which in turn starts another sub-process and then closes |
| 8 // its standard output. If handles are incorrectly inherited on Windows, this | 8 // its standard output. If handles are incorrectly inherited on Windows, this |
| 9 // will lead to a situation where the stdout of the first sub-process is never | 9 // will lead to a situation where the stdout of the first sub-process is never |
| 10 // closed which will make this test hang. | 10 // closed which will make this test hang. |
| 11 | 11 |
| 12 import 'dart:io'; | 12 import 'dart:io'; |
| 13 | 13 |
| 14 import "package:async_helper/async_helper.dart"; | 14 import "package:async_helper/async_helper.dart"; |
| 15 import "package:expect/expect.dart"; | 15 import "package:expect/expect.dart"; |
| 16 import 'package:path/path.dart'; | 16 import 'package:path/path.dart'; |
| 17 | 17 |
| 18 main() { | 18 main() { |
| 19 asyncStart(); | 19 asyncStart(); |
| 20 var executable = Platform.executable; | 20 var executable = Platform.executable; |
| 21 var script = join(dirname(Platform.script), 'regress_7191_script.dart'); | 21 var script = Platform.script.resolve('regress_7191_script.dart').toFilePath(); |
| 22 Process.start(executable, [script]).then((process) { | 22 Process.start(executable, [script]).then((process) { |
| 23 process.stdin.add([0]); | 23 process.stdin.add([0]); |
| 24 process.stdout.listen((_) { }, | 24 process.stdout.listen((_) { }, |
| 25 onDone: () { process.stdin.add([0]); }); | 25 onDone: () { process.stdin.add([0]); }); |
| 26 process.stderr.listen((_) { }); | 26 process.stderr.listen((_) { }); |
| 27 process.exitCode.then((exitCode) { | 27 process.exitCode.then((exitCode) { |
| 28 asyncEnd(); | 28 asyncEnd(); |
| 29 if (exitCode != 0) throw "Bad exit code"; | 29 if (exitCode != 0) throw "Bad exit code"; |
| 30 }); | 30 }); |
| 31 }); | 31 }); |
| 32 } | 32 } |
| OLD | NEW |