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