| 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 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 _ProcessImpl(String path, List<String> arguments, ProcessOptions options) { | 46 _ProcessImpl(String path, List<String> arguments, ProcessOptions options) { |
| 47 if (path is !String) { | 47 if (path is !String) { |
| 48 throw new ArgumentError("Path is not a String: $path"); | 48 throw new ArgumentError("Path is not a String: $path"); |
| 49 } | 49 } |
| 50 _path = path; | 50 _path = path; |
| 51 | 51 |
| 52 if (arguments is !List) { | 52 if (arguments is !List) { |
| 53 throw new ArgumentError("Arguments is not a List: $arguments"); | 53 throw new ArgumentError("Arguments is not a List: $arguments"); |
| 54 } | 54 } |
| 55 int len = arguments.length; | 55 int len = arguments.length; |
| 56 _arguments = new List<String>.fixedLength(len); | 56 _arguments = new List<String>(len); |
| 57 for (int i = 0; i < len; i++) { | 57 for (int i = 0; i < len; i++) { |
| 58 var arg = arguments[i]; | 58 var arg = arguments[i]; |
| 59 if (arg is !String) { | 59 if (arg is !String) { |
| 60 throw new ArgumentError("Non-string argument: $arg"); | 60 throw new ArgumentError("Non-string argument: $arg"); |
| 61 } | 61 } |
| 62 _arguments[i] = arguments[i]; | 62 _arguments[i] = arguments[i]; |
| 63 if (Platform.operatingSystem == 'windows') { | 63 if (Platform.operatingSystem == 'windows') { |
| 64 _arguments[i] = _windowsArgumentEscape(_arguments[i]); | 64 _arguments[i] = _windowsArgumentEscape(_arguments[i]); |
| 65 } | 65 } |
| 66 } | 66 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 status._errorMessage, | 174 status._errorMessage, |
| 175 status._errorCode)); | 175 status._errorCode)); |
| 176 return; | 176 return; |
| 177 } | 177 } |
| 178 _started = true; | 178 _started = true; |
| 179 | 179 |
| 180 // Setup an exit handler to handle internal cleanup and possible | 180 // Setup an exit handler to handle internal cleanup and possible |
| 181 // callback when a process terminates. | 181 // callback when a process terminates. |
| 182 int exitDataRead = 0; | 182 int exitDataRead = 0; |
| 183 final int EXIT_DATA_SIZE = 8; | 183 final int EXIT_DATA_SIZE = 8; |
| 184 List<int> exitDataBuffer = new List<int>.fixedLength(EXIT_DATA_SIZE); | 184 List<int> exitDataBuffer = new List<int>(EXIT_DATA_SIZE); |
| 185 _exitHandler.listen((data) { | 185 _exitHandler.listen((data) { |
| 186 | 186 |
| 187 int exitCode(List<int> ints) { | 187 int exitCode(List<int> ints) { |
| 188 var code = _intFromBytes(ints, 0); | 188 var code = _intFromBytes(ints, 0); |
| 189 var negative = _intFromBytes(ints, 4); | 189 var negative = _intFromBytes(ints, 4); |
| 190 assert(negative == 0 || negative == 1); | 190 assert(negative == 0 || negative == 1); |
| 191 return (negative == 0) ? code : -code; | 191 return (negative == 0) ? code : -code; |
| 192 } | 192 } |
| 193 | 193 |
| 194 void handleExit() { | 194 void handleExit() { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 | 326 |
| 327 class _ProcessResult implements ProcessResult { | 327 class _ProcessResult implements ProcessResult { |
| 328 const _ProcessResult(int this.exitCode, | 328 const _ProcessResult(int this.exitCode, |
| 329 String this.stdout, | 329 String this.stdout, |
| 330 String this.stderr); | 330 String this.stderr); |
| 331 | 331 |
| 332 final int exitCode; | 332 final int exitCode; |
| 333 final String stdout; | 333 final String stdout; |
| 334 final String stderr; | 334 final String stderr; |
| 335 } | 335 } |
| OLD | NEW |