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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 _stderr._stream._nativeSocket, | 483 _stderr._stream._nativeSocket, |
484 _exitHandler._nativeSocket); | 484 _exitHandler._nativeSocket); |
485 | 485 |
486 getOutput(output, encoding) { | 486 getOutput(output, encoding) { |
487 if (encoding == null) return output; | 487 if (encoding == null) return output; |
488 return encoding.decode(output); | 488 return encoding.decode(output); |
489 } | 489 } |
490 | 490 |
491 _processes.remove(_serviceId); | 491 _processes.remove(_serviceId); |
492 | 492 |
493 return new _ProcessResult( | 493 return new ProcessResult( |
494 result[0], | 494 result[0], |
495 result[1], | 495 result[1], |
496 getOutput(result[2], stdoutEncoding), | 496 getOutput(result[2], stdoutEncoding), |
497 getOutput(result[3], stderrEncoding)); | 497 getOutput(result[3], stderrEncoding)); |
498 } | 498 } |
499 | 499 |
500 bool _startNative(String path, | 500 bool _startNative(String path, |
501 List<String> arguments, | 501 List<String> arguments, |
502 String workingDirectory, | 502 String workingDirectory, |
503 List<String> environment, | 503 List<String> environment, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 return buf; | 595 return buf; |
596 }) | 596 }) |
597 .then((sb) => sb.toString()); | 597 .then((sb) => sb.toString()); |
598 } | 598 } |
599 } | 599 } |
600 | 600 |
601 Future stdout = foldStream(p.stdout, stdoutEncoding); | 601 Future stdout = foldStream(p.stdout, stdoutEncoding); |
602 Future stderr = foldStream(p.stderr, stderrEncoding); | 602 Future stderr = foldStream(p.stderr, stderrEncoding); |
603 | 603 |
604 return Future.wait([p.exitCode, stdout, stderr]).then((result) { | 604 return Future.wait([p.exitCode, stdout, stderr]).then((result) { |
605 return new _ProcessResult(pid, result[0], result[1], result[2]); | 605 return new ProcessResult(pid, result[0], result[1], result[2]); |
606 }); | 606 }); |
607 }); | 607 }); |
608 } | 608 } |
609 | 609 |
610 ProcessResult _runNonInteractiveProcessSync( | 610 ProcessResult _runNonInteractiveProcessSync( |
611 String executable, | 611 String executable, |
612 List<String> arguments, | 612 List<String> arguments, |
613 String workingDirectory, | 613 String workingDirectory, |
614 Map<String, String> environment, | 614 Map<String, String> environment, |
615 bool includeParentEnvironment, | 615 bool includeParentEnvironment, |
616 bool runInShell, | 616 bool runInShell, |
617 Encoding stdoutEncoding, | 617 Encoding stdoutEncoding, |
618 Encoding stderrEncoding) { | 618 Encoding stderrEncoding) { |
619 var process = new _ProcessImpl(executable, | 619 var process = new _ProcessImpl(executable, |
620 arguments, | 620 arguments, |
621 workingDirectory, | 621 workingDirectory, |
622 environment, | 622 environment, |
623 includeParentEnvironment, | 623 includeParentEnvironment, |
624 runInShell, | 624 runInShell, |
625 ProcessStartMode.NORMAL); | 625 ProcessStartMode.NORMAL); |
626 return process._runAndWait(stdoutEncoding, stderrEncoding); | 626 return process._runAndWait(stdoutEncoding, stderrEncoding); |
627 } | 627 } |
628 | |
629 | |
630 class _ProcessResult implements ProcessResult { | |
631 const _ProcessResult(int this.pid, | |
632 int this.exitCode, | |
633 this.stdout, | |
634 this.stderr); | |
635 | |
636 final int pid; | |
637 final int exitCode; | |
638 final stdout; | |
639 final stderr; | |
640 } | |
OLD | NEW |