| 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 // TODO(ager): The only reason for this class is that we | 5 // TODO(ager): The only reason for this class is that we |
| 6 // cannot patch a top-level at this point. | 6 // cannot patch a top-level at this point. |
| 7 class _ProcessUtils { | 7 class _ProcessUtils { |
| 8 external static _exit(int status); | 8 external static _exit(int status); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 static const ProcessSignal SIGPROF = const ProcessSignal._signal(27); | 207 static const ProcessSignal SIGPROF = const ProcessSignal._signal(27); |
| 208 static const ProcessSignal SIGPOLL = const ProcessSignal._signal(29); | 208 static const ProcessSignal SIGPOLL = const ProcessSignal._signal(29); |
| 209 static const ProcessSignal SIGSYS = const ProcessSignal._signal(31); | 209 static const ProcessSignal SIGSYS = const ProcessSignal._signal(31); |
| 210 | 210 |
| 211 const ProcessSignal._signal(int this._signalNumber); | 211 const ProcessSignal._signal(int this._signalNumber); |
| 212 final int _signalNumber; | 212 final int _signalNumber; |
| 213 } | 213 } |
| 214 | 214 |
| 215 | 215 |
| 216 class ProcessException implements Exception { | 216 class ProcessException implements Exception { |
| 217 const ProcessException([String this.message = "", int this.errorCode = 0]); | 217 const ProcessException(String this.executable, |
| 218 String toString() => "ProcessException: $message ($errorCode)"; | 218 List<String> this.arguments, |
| 219 [String this.message = "", |
| 220 int this.errorCode = 0]); |
| 221 String toString() { |
| 222 var msg = (message == null) ? 'OS error code: $errorCode' : message; |
| 223 var args = Strings.join(arguments, ' '); |
| 224 return "ProcessException: $msg\n Command: $executable $args"; |
| 225 } |
| 226 |
| 227 /** |
| 228 * Contains the executable provided for the process. |
| 229 */ |
| 230 final String executable; |
| 231 |
| 232 /** |
| 233 * Contains the arguments provided for the process. |
| 234 */ |
| 235 final List<String> arguments; |
| 219 | 236 |
| 220 /** | 237 /** |
| 221 * Contains the system message for the process exception if any. | 238 * Contains the system message for the process exception if any. |
| 222 */ | 239 */ |
| 223 final String message; | 240 final String message; |
| 224 | 241 |
| 225 /** | 242 /** |
| 226 * Contains the OS error code for the process exception if any. | 243 * Contains the OS error code for the process exception if any. |
| 227 */ | 244 */ |
| 228 final int errorCode; | 245 final int errorCode; |
| 229 } | 246 } |
| OLD | NEW |