OLD | NEW |
---|---|
1 // Copyright (c) 2012, 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 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 // TODO(ager): The only reason for this class is that we | 7 // TODO(ager): The only reason for this class is that we |
Mads Ager (google)
2013/04/05 05:51:48
I *think* this has been fixed now. As a followup w
Søren Gjesse
2013/04/05 09:33:22
No, it is still not fixed.
| |
8 // cannot patch a top-level at this point. | 8 // cannot patch a top-level at this point. |
9 class _ProcessUtils { | 9 class _ProcessUtils { |
10 external static _exit(int status); | 10 external static _exit(int status); |
11 external static _setExitCode(int status); | 11 external static _setExitCode(int status); |
12 external static _sleep(int status); | |
12 } | 13 } |
13 | 14 |
14 /** | 15 /** |
15 * Exit the Dart VM process immediately with the given [status] code. | 16 * Exit the Dart VM process immediately with the given [status] code. |
16 * | 17 * |
17 * This does not wait for any asynchronous operations to terminate. Using | 18 * This does not wait for any asynchronous operations to terminate. Using |
18 * [exit] is therefore very likely to lose data. | 19 * [exit] is therefore very likely to lose data. |
19 */ | 20 */ |
20 void exit(int status) { | 21 void exit(int status) { |
21 if (status is !int) { | 22 if (status is !int) { |
(...skipping 10 matching lines...) Expand all Loading... | |
32 * on normal termination. | 33 * on normal termination. |
33 */ | 34 */ |
34 set exitCode(int status) { | 35 set exitCode(int status) { |
35 if (status is !int) { | 36 if (status is !int) { |
36 throw new ArgumentError("setExitCode: int status expected"); | 37 throw new ArgumentError("setExitCode: int status expected"); |
37 } | 38 } |
38 _ProcessUtils._setExitCode(status); | 39 _ProcessUtils._setExitCode(status); |
39 } | 40 } |
40 | 41 |
41 /** | 42 /** |
43 * Sleep for the duration specified in [duration]. | |
44 * | |
45 * Use this with care, as no asynchronous operations can be processed | |
46 * in a isolate while it is blocked in a [sleep] call. | |
47 */ | |
48 void sleep(Duration duration) { | |
49 _ProcessUtils._sleep(duration.inMilliseconds); | |
50 } | |
51 | |
52 /** | |
42 * [Process] is used to start new processes using the static | 53 * [Process] is used to start new processes using the static |
43 * [start] and [run] methods. | 54 * [start] and [run] methods. |
44 */ | 55 */ |
45 abstract class Process { | 56 abstract class Process { |
46 /** | 57 /** |
47 * Starts a process running the [executable] with the specified | 58 * Starts a process running the [executable] with the specified |
48 * [arguments]. Returns a [:Future<Process>:] that completes with a | 59 * [arguments]. Returns a [:Future<Process>:] that completes with a |
49 * Process instance when the process has been successfully | 60 * Process instance when the process has been successfully |
50 * started. That [Process] object can be used to interact with the | 61 * started. That [Process] object can be used to interact with the |
51 * process. If the process cannot be started the returned [Future] | 62 * process. If the process cannot be started the returned [Future] |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
259 /** | 270 /** |
260 * Contains the system message for the process exception if any. | 271 * Contains the system message for the process exception if any. |
261 */ | 272 */ |
262 final String message; | 273 final String message; |
263 | 274 |
264 /** | 275 /** |
265 * Contains the OS error code for the process exception if any. | 276 * Contains the OS error code for the process exception if any. |
266 */ | 277 */ |
267 final int errorCode; | 278 final int errorCode; |
268 } | 279 } |
OLD | NEW |