| Index: runtime/bin/file_impl.dart
|
| diff --git a/runtime/bin/file_impl.dart b/runtime/bin/file_impl.dart
|
| index d847acb9b8df72debe6f7411b6add5c47c368de4..771a9b9e85692284c7a93a1b9e853fd2115f5e79 100644
|
| --- a/runtime/bin/file_impl.dart
|
| +++ b/runtime/bin/file_impl.dart
|
| @@ -10,6 +10,14 @@ class _FileInputStream extends _BaseDataInputStream implements InputStream {
|
| _checkScheduleCallbacks();
|
| }
|
|
|
| + _FileInputStream.fromStdio(int fd) {
|
| + assert(fd == 0);
|
| + _file = _File._openStdioSync(fd);
|
| + _length = _file.lengthSync();
|
| + _streamMarkedClosed = true;
|
| + _checkScheduleCallbacks();
|
| + }
|
| +
|
| int available() {
|
| return _closed ? 0 : _length - _file.positionSync();
|
| }
|
| @@ -53,6 +61,11 @@ class _FileOutputStream implements OutputStream {
|
| _file = file.openSync(mode);
|
| }
|
|
|
| + _FileOutputStream.fromStdio(int fd) {
|
| + assert(1 <= fd && fd <= 2);
|
| + _file = _File._openStdioSync(fd);
|
| + }
|
| +
|
| bool write(List<int> buffer, [bool copyBuffer = false]) {
|
| return _write(buffer, 0, buffer.length);
|
| }
|
| @@ -452,6 +465,7 @@ class _FileUtils {
|
| static bool truncate(int id, int length) native "File_Truncate";
|
| static int length(int id) native "File_Length";
|
| static int flush(int id) native "File_Flush";
|
| + static int openStdio(int fd) native "File_OpenStdio";
|
|
|
| static int checkedOpen(String name, int mode) {
|
| if (name is !String || mode is !int) return 0;
|
| @@ -618,6 +632,14 @@ class _File implements File {
|
| return new _RandomAccessFile(id, _name);
|
| }
|
|
|
| + static RandomAccessFile _openStdioSync(int fd) {
|
| + var id = _FileUtils.openStdio(fd);
|
| + if (id == 0) {
|
| + throw new FileIOException("Cannot open stdio file for: $fd");
|
| + }
|
| + return new _RandomAccessFile(id, "");
|
| + }
|
| +
|
| void fullPath() {
|
| _asyncUsed = true;
|
| var handleFullPathResult = (result, ignored) {
|
|
|