| 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 // Process test program to test process communication. | 5 // Process test program to test process communication. |
| 6 | 6 |
| 7 import "package:expect/expect.dart"; | |
| 8 import "dart:async"; | 7 import "dart:async"; |
| 9 import "dart:io"; | 8 import "dart:io"; |
| 10 import "dart:isolate"; | 9 |
| 10 import "package:async_helper/async_helper.dart"; |
| 11 import "package:expect/expect.dart"; |
| 11 | 12 |
| 12 main() { | 13 main() { |
| 13 var port = new ReceivePort(); | 14 asyncStart(); |
| 14 Expect.isTrue(pid > 0); | 15 Expect.isTrue(pid > 0); |
| 15 var futures = []; | 16 var futures = []; |
| 16 futures.add(Process.start(Platform.executable,['--version'])); | 17 futures.add(Process.start(Platform.executable,['--version'])); |
| 17 futures.add(Process.run(Platform.executable,['--version'])); | 18 futures.add(Process.run(Platform.executable,['--version'])); |
| 18 Future.wait(futures).then((results) { | 19 Future.wait(futures).then((results) { |
| 19 Expect.isTrue(results[0].pid > 0); | 20 Expect.isTrue(results[0].pid > 0); |
| 20 Expect.isTrue(results[1].pid > 0); | 21 Expect.isTrue(results[1].pid > 0); |
| 21 Expect.equals(0, results[1].exitCode); | 22 Expect.equals(0, results[1].exitCode); |
| 22 results[0].exitCode.then((exitCode) { | 23 results[0].exitCode.then((exitCode) { |
| 23 Expect.equals(0, exitCode); | 24 Expect.equals(0, exitCode); |
| 24 port.close(); | 25 asyncEnd(); |
| 25 }); | 26 }); |
| 26 }); | 27 }); |
| 27 } | 28 } |
| OLD | NEW |