My favorites | Sign in
Project Home Wiki Issues Source Code Search
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 401: Error while reading from a pipe with an InputStream
3 people starred this issue and may be notified of changes. Back to list
 
Reported by rchandia@google.com, Nov 9, 2011
Problem is that FileInputStream assumes the file is seekable.

void main() {

  File stdinFile = new File('/proc/self/fd/0');
  stdinFile.open();
  InputStream stdin = stdinFile.openInputStream();

  void readMore() {
    print(stdin.read(1));
  }

  stdin.dataHandler = readMore;
  readMore();
}

Produces:
An unhandled exception has been thrown
FileIOException: length failed
 0. Function: '_File@689f3ad.lengthSync' url: './dart:builtin-lib' line:1382 col:7
 1. Function: '_FileInputStream@689f3ad.available' url: './dart:builtin-lib' line:642 col:28
 2. Function: '_FileInputStream@689f3ad.read' url: './dart:builtin-lib' line:611 col:32
 3. Function: 'readMore' url: '/tmp/stdin.dart' line:7 col:21
 4. Function: 'main' url: '/tmp/stdin.dart' line:11 col:11

Nov 9, 2011
#1 rchandia@google.com
(No comment was entered for this change.)
Cc: dcarlson@google.com
Nov 21, 2011
Project Member #2 iposva@google.com
(No comment was entered for this change.)
Status: Accepted
Owner: ager@google.com
Feb 20, 2012
Project Member #3 ager@google.com
(No comment was entered for this change.)
Labels: -Area-VM Area-IO
Jun 7, 2012
Project Member #4 ager@google.com
(No comment was entered for this change.)
Labels: Milestone-Later
Apr 2, 2013
Project Member #5 ajohnsen@google.com
(No comment was entered for this change.)
Owner: ajohnsen@google.com
Apr 2, 2013
Project Member #6 ajohnsen@google.com
Fix landed in r20768.
Status: Fixed
Labels: -Milestone-Later Milestone-M4
May 14, 2014
Project Member #7 kevmoo@google.com
(No comment was entered for this change.)
Labels: -Area-IO Area-Library Library-IO
Sign in to add a comment

Powered by Google Project Hosting