| 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 patch class _WindowsCodePageDecoder { | 5 patch class _WindowsCodePageDecoder { |
| 6 /* patch */ static String _decodeBytes(List<int> bytes) | 6 /* patch */ static String _decodeBytes(List<int> bytes) |
| 7 native "SystemEncodingToString"; | 7 native "SystemEncodingToString"; |
| 8 } | 8 } |
| 9 | 9 |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 Encoding stderrEncoding: SYSTEM_ENCODING}) { | 63 Encoding stderrEncoding: SYSTEM_ENCODING}) { |
| 64 return _runNonInteractiveProcessSync(executable, | 64 return _runNonInteractiveProcessSync(executable, |
| 65 arguments, | 65 arguments, |
| 66 workingDirectory, | 66 workingDirectory, |
| 67 environment, | 67 environment, |
| 68 includeParentEnvironment, | 68 includeParentEnvironment, |
| 69 runInShell, | 69 runInShell, |
| 70 stdoutEncoding, | 70 stdoutEncoding, |
| 71 stderrEncoding); | 71 stderrEncoding); |
| 72 } | 72 } |
| 73 |
| 74 /* patch */ static bool killPid( |
| 75 int pid, [ProcessSignal signal = ProcessSignal.SIGTERM]) { |
| 76 if (signal is! ProcessSignal) { |
| 77 throw new ArgumentError( |
| 78 "Argument 'signal' must be a ProcessSignal"); |
| 79 } |
| 80 return _ProcessUtils._killPid(pid, signal._signalNumber); |
| 81 } |
| 73 } | 82 } |
| 74 | 83 |
| 75 | 84 |
| 76 List<_SignalController> _signalControllers = new List(32); | 85 List<_SignalController> _signalControllers = new List(32); |
| 77 | 86 |
| 78 | 87 |
| 79 class _SignalController { | 88 class _SignalController { |
| 80 final ProcessSignal signal; | 89 final ProcessSignal signal; |
| 81 | 90 |
| 82 StreamController _controller; | 91 StreamController _controller; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 Function _getWatchSignalInternal() => _ProcessUtils._watchSignalInternal; | 134 Function _getWatchSignalInternal() => _ProcessUtils._watchSignalInternal; |
| 126 | 135 |
| 127 | 136 |
| 128 patch class _ProcessUtils { | 137 patch class _ProcessUtils { |
| 129 /* patch */ static void _exit(int status) native "Process_Exit"; | 138 /* patch */ static void _exit(int status) native "Process_Exit"; |
| 130 /* patch */ static void _setExitCode(int status) | 139 /* patch */ static void _setExitCode(int status) |
| 131 native "Process_SetExitCode"; | 140 native "Process_SetExitCode"; |
| 132 /* patch */ static int _getExitCode() native "Process_GetExitCode"; | 141 /* patch */ static int _getExitCode() native "Process_GetExitCode"; |
| 133 /* patch */ static void _sleep(int millis) native "Process_Sleep"; | 142 /* patch */ static void _sleep(int millis) native "Process_Sleep"; |
| 134 /* patch */ static int _pid(Process process) native "Process_Pid"; | 143 /* patch */ static int _pid(Process process) native "Process_Pid"; |
| 144 static int _killPid(int pid, ProcessSignal signal) |
| 145 native "Process_KillPid"; |
| 135 /* patch */ static Stream<ProcessSignal> _watchSignal(ProcessSignal signal) { | 146 /* patch */ static Stream<ProcessSignal> _watchSignal(ProcessSignal signal) { |
| 136 if (signal != ProcessSignal.SIGHUP && | 147 if (signal != ProcessSignal.SIGHUP && |
| 137 signal != ProcessSignal.SIGINT && | 148 signal != ProcessSignal.SIGINT && |
| 138 signal != ProcessSignal.SIGTERM && | 149 signal != ProcessSignal.SIGTERM && |
| 139 (Platform.isWindows || | 150 (Platform.isWindows || |
| 140 (signal != ProcessSignal.SIGUSR1 && | 151 (signal != ProcessSignal.SIGUSR1 && |
| 141 signal != ProcessSignal.SIGUSR2 && | 152 signal != ProcessSignal.SIGUSR2 && |
| 142 signal != ProcessSignal.SIGWINCH))) { | 153 signal != ProcessSignal.SIGWINCH))) { |
| 143 throw new SignalException( | 154 throw new SignalException( |
| 144 "Listening for signal $signal is not supported"); | 155 "Listening for signal $signal is not supported"); |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 | 522 |
| 512 Future<int> get exitCode => _exitCode != null ? _exitCode.future : null; | 523 Future<int> get exitCode => _exitCode != null ? _exitCode.future : null; |
| 513 | 524 |
| 514 bool kill([ProcessSignal signal = ProcessSignal.SIGTERM]) { | 525 bool kill([ProcessSignal signal = ProcessSignal.SIGTERM]) { |
| 515 if (signal is! ProcessSignal) { | 526 if (signal is! ProcessSignal) { |
| 516 throw new ArgumentError( | 527 throw new ArgumentError( |
| 517 "Argument 'signal' must be a ProcessSignal"); | 528 "Argument 'signal' must be a ProcessSignal"); |
| 518 } | 529 } |
| 519 assert(_started); | 530 assert(_started); |
| 520 if (_ended) return false; | 531 if (_ended) return false; |
| 521 return _kill(this, signal._signalNumber); | 532 return _ProcessUtils._killPid(pid, signal._signalNumber); |
| 522 } | 533 } |
| 523 | 534 |
| 524 bool _kill(Process p, int signal) native "Process_Kill"; | |
| 525 | |
| 526 int get pid => _ProcessUtils._pid(this); | 535 int get pid => _ProcessUtils._pid(this); |
| 527 | 536 |
| 528 String _path; | 537 String _path; |
| 529 List<String> _arguments; | 538 List<String> _arguments; |
| 530 String _workingDirectory; | 539 String _workingDirectory; |
| 531 List<String> _environment; | 540 List<String> _environment; |
| 532 bool _detach; | 541 bool _detach; |
| 533 // Private methods of Socket are used by _in, _out, and _err. | 542 // Private methods of Socket are used by _in, _out, and _err. |
| 534 _StdSink _stdin; | 543 _StdSink _stdin; |
| 535 _StdStream _stdout; | 544 _StdStream _stdout; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 const _ProcessResult(int this.pid, | 626 const _ProcessResult(int this.pid, |
| 618 int this.exitCode, | 627 int this.exitCode, |
| 619 this.stdout, | 628 this.stdout, |
| 620 this.stderr); | 629 this.stderr); |
| 621 | 630 |
| 622 final int pid; | 631 final int pid; |
| 623 final int exitCode; | 632 final int exitCode; |
| 624 final stdout; | 633 final stdout; |
| 625 final stderr; | 634 final stderr; |
| 626 } | 635 } |
| OLD | NEW |