| 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 /** Exit the Dart VM process with the given [status] code. */ | 5 /** Exit the Dart VM process with the given [status] code. */ |
| 6 void exit(int status) { | 6 void exit(int status) { |
| 7 if (status is !int) { | 7 if (status is !int) { |
| 8 throw new ArgumentError("int status expected"); | 8 throw new ArgumentError("int status expected"); |
| 9 } | 9 } |
| 10 _exit(status); | 10 _exit(status); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 * Throws an [UnsupportedOperationException] if the process is | 80 * Throws an [UnsupportedOperationException] if the process is |
| 81 * non-interactive. | 81 * non-interactive. |
| 82 */ | 82 */ |
| 83 abstract void set onExit(void callback(int exitCode)); | 83 abstract void set onExit(void callback(int exitCode)); |
| 84 | 84 |
| 85 /** | 85 /** |
| 86 * On Windows, [kill] kills the process, ignoring the [signal] | 86 * On Windows, [kill] kills the process, ignoring the [signal] |
| 87 * flag. On Posix systems, [kill] sends [signal] to the | 87 * flag. On Posix systems, [kill] sends [signal] to the |
| 88 * process. Depending on the signal giving, it'll have different | 88 * process. Depending on the signal giving, it'll have different |
| 89 * meanings. When the process terminates as a result of calling | 89 * meanings. When the process terminates as a result of calling |
| 90 * [kill] [onExit] is called. If the kill operation fails an | 90 * [kill] [onExit] is called. |
| 91 * exception is thrown. | 91 * |
| 92 * Returns [:true:] if the process is successfully killed (the |
| 93 * signal is successfully sent). Returns [:false:] if the process |
| 94 * could not be killed (the signal could not be sent). Usually, |
| 95 * a [:false:] return value from kill means that the process is |
| 96 * already dead. |
| 92 */ | 97 */ |
| 93 abstract void kill([ProcessSignal signal = ProcessSignal.SIGTERM]); | 98 abstract bool kill([ProcessSignal signal = ProcessSignal.SIGTERM]); |
| 94 | 99 |
| 95 /** | 100 /** |
| 96 * Terminates the streams of a process. [close] must be called on a | 101 * Terminates the streams of a process. [close] must be called on a |
| 97 * process to free the system resources associated with it if not all | 102 * process to free the system resources associated with it if not all |
| 98 * data on the stdout and stderr streams have been read. Usually, | 103 * data on the stdout and stderr streams have been read. Usually, |
| 99 * close should be called in [onExit], but care must be taken to actually | 104 * close should be called in [onExit], but care must be taken to actually |
| 100 * wait on the stderr and stdout streams to close if all data is required. | 105 * wait on the stderr and stdout streams to close if all data is required. |
| 101 * Once a process has been closed it can no longer be killed and [onExit] | 106 * Once a process has been closed it can no longer be killed and [onExit] |
| 102 * is detached so the application is not notified of process termination. | 107 * is detached so the application is not notified of process termination. |
| 103 */ | 108 */ |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 /** | 224 /** |
| 220 * Contains the system message for the process exception if any. | 225 * Contains the system message for the process exception if any. |
| 221 */ | 226 */ |
| 222 final String message; | 227 final String message; |
| 223 | 228 |
| 224 /** | 229 /** |
| 225 * Contains the OS error code for the process exception if any. | 230 * Contains the OS error code for the process exception if any. |
| 226 */ | 231 */ |
| 227 final int errorCode; | 232 final int errorCode; |
| 228 } | 233 } |
| OLD | NEW |