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 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 |
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 void _exit(int status); | 10 external static void _exit(int status); |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 static const ProcessSignal SIGPOLL = const ProcessSignal._(29, "SIGPOLL"); | 339 static const ProcessSignal SIGPOLL = const ProcessSignal._(29, "SIGPOLL"); |
340 static const ProcessSignal SIGSYS = const ProcessSignal._(31, "SIGSYS"); | 340 static const ProcessSignal SIGSYS = const ProcessSignal._(31, "SIGSYS"); |
341 | 341 |
342 final int _signalNumber; | 342 final int _signalNumber; |
343 final String _name; | 343 final String _name; |
344 | 344 |
345 const ProcessSignal._(this._signalNumber, this._name); | 345 const ProcessSignal._(this._signalNumber, this._name); |
346 | 346 |
347 String toString() => _name; | 347 String toString() => _name; |
348 | 348 |
| 349 /** |
| 350 * Watch for process signals. |
| 351 * |
| 352 * The following [ProcessSignal]s can be listened to: |
| 353 * |
| 354 * * [ProcessSignal.SIGHUP]. |
| 355 * * [ProcessSignal.SIGINT]. |
| 356 * * [ProcessSignal.SIGTERM]. Not available on Windows. |
| 357 * * [ProcessSignal.SIGUSR1]. Not available on Windows. |
| 358 * * [ProcessSignal.SIGUSR2]. Not available on Windows. |
| 359 * * [ProcessSignal.SIGWINCH]. Not available on Windows. |
| 360 * |
| 361 * Other signals are disallowed, as they may be used by the VM. |
| 362 */ |
349 Stream<ProcessSignal> watch() => _ProcessUtils._watchSignal(this); | 363 Stream<ProcessSignal> watch() => _ProcessUtils._watchSignal(this); |
350 } | 364 } |
351 | 365 |
352 | 366 |
353 class SignalException implements IOException { | 367 class SignalException implements IOException { |
354 final String message; | 368 final String message; |
355 final osError; | 369 final osError; |
356 | 370 |
357 const SignalException(this.message, [this.osError = null]); | 371 const SignalException(this.message, [this.osError = null]); |
358 | 372 |
(...skipping 29 matching lines...) Expand all Loading... |
388 final int errorCode; | 402 final int errorCode; |
389 | 403 |
390 const ProcessException(this.executable, this.arguments, [this.message = "", | 404 const ProcessException(this.executable, this.arguments, [this.message = "", |
391 this.errorCode = 0]); | 405 this.errorCode = 0]); |
392 String toString() { | 406 String toString() { |
393 var msg = (message == null) ? 'OS error code: $errorCode' : message; | 407 var msg = (message == null) ? 'OS error code: $errorCode' : message; |
394 var args = arguments.join(' '); | 408 var args = arguments.join(' '); |
395 return "ProcessException: $msg\n Command: $executable $args"; | 409 return "ProcessException: $msg\n Command: $executable $args"; |
396 } | 410 } |
397 } | 411 } |
OLD | NEW |