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