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 { |
| 6 /* patch */ static String _decodeBytes(List<int> bytes) |
| 7 native "SystemEncodingToString"; |
| 8 } |
| 9 |
| 10 |
| 11 patch class _WindowsCodePageEncoder { |
| 12 /* patch */ static List<int> _encodeString(String string) |
| 13 native "StringToSystemEncoding"; |
| 14 } |
| 15 |
| 16 |
5 patch class Process { | 17 patch class Process { |
6 /* patch */ static Future<Process> start(String executable, | 18 /* patch */ static Future<Process> start(String executable, |
7 List<String> arguments, | 19 List<String> arguments, |
8 [ProcessOptions options]) { | 20 [ProcessOptions options]) { |
9 _ProcessImpl process = new _ProcessImpl(executable, arguments, options); | 21 _ProcessImpl process = new _ProcessImpl(executable, arguments, options); |
10 return process._start(); | 22 return process._start(); |
11 } | 23 } |
12 | 24 |
13 /* patch */ static Future<ProcessResult> run(String executable, | 25 /* patch */ static Future<ProcessResult> run(String executable, |
14 List<String> arguments, | 26 List<String> arguments, |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // _NonInteractiveProcess is a wrapper around an interactive process | 283 // _NonInteractiveProcess is a wrapper around an interactive process |
272 // that buffers output so it can be delivered when the process exits. | 284 // that buffers output so it can be delivered when the process exits. |
273 // _NonInteractiveProcess is used to implement the Process.run | 285 // _NonInteractiveProcess is used to implement the Process.run |
274 // method. | 286 // method. |
275 class _NonInteractiveProcess { | 287 class _NonInteractiveProcess { |
276 _NonInteractiveProcess(String path, | 288 _NonInteractiveProcess(String path, |
277 List<String> arguments, | 289 List<String> arguments, |
278 ProcessOptions options) { | 290 ProcessOptions options) { |
279 _completer = new Completer<ProcessResult>(); | 291 _completer = new Completer<ProcessResult>(); |
280 // Extract output encoding options and verify arguments. | 292 // Extract output encoding options and verify arguments. |
281 var stdoutEncoding = Encoding.UTF_8; | 293 var stdoutEncoding = Encoding.SYSTEM; |
282 var stderrEncoding = Encoding.UTF_8; | 294 var stderrEncoding = Encoding.SYSTEM; |
283 if (options != null) { | 295 if (options != null) { |
284 if (options.stdoutEncoding != null) { | 296 if (options.stdoutEncoding != null) { |
285 stdoutEncoding = options.stdoutEncoding; | 297 stdoutEncoding = options.stdoutEncoding; |
286 if (stdoutEncoding is !Encoding) { | 298 if (stdoutEncoding is !Encoding) { |
287 throw new ArgumentError( | 299 throw new ArgumentError( |
288 'stdoutEncoding option is not an encoding: $stdoutEncoding'); | 300 'stdoutEncoding option is not an encoding: $stdoutEncoding'); |
289 } | 301 } |
290 } | 302 } |
291 if (options.stderrEncoding != null) { | 303 if (options.stderrEncoding != null) { |
292 stderrEncoding = options.stderrEncoding; | 304 stderrEncoding = options.stderrEncoding; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 374 |
363 class _ProcessResult implements ProcessResult { | 375 class _ProcessResult implements ProcessResult { |
364 const _ProcessResult(int this.exitCode, | 376 const _ProcessResult(int this.exitCode, |
365 String this.stdout, | 377 String this.stdout, |
366 String this.stderr); | 378 String this.stderr); |
367 | 379 |
368 final int exitCode; | 380 final int exitCode; |
369 final String stdout; | 381 final String stdout; |
370 final String stderr; | 382 final String stderr; |
371 } | 383 } |
OLD | NEW |