Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Piping a file to Dart VM stdin never gets a close event #782

Closed
sgjesse opened this issue Dec 9, 2011 · 2 comments
Closed

Piping a file to Dart VM stdin never gets a close event #782

sgjesse opened this issue Dec 9, 2011 · 2 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@sgjesse
Copy link
Contributor

sgjesse commented Dec 9, 2011

Running the following Dart program (test.dart)

main() {
  stdin.dataHandler = () { print(new String.fromCharCodes(stdin.read())); };
  stdin.closeHandler = () { print("close"); };
}

These two different ways

$ cat myfile | dart test.dart
$ dart test.dart < myfile

Only the first (using pipe) will print "close" and terminate.

If you know the Area- label, please set it and change status to Triaged.*

@sgjesse
Copy link
Contributor Author

sgjesse commented Dec 9, 2011

Running on Linux with DEBUG_POLL defined in eventhandler_linux.cc reveals the issue.

$ cat myfile | dart test.dart

0 POLLIN POLLHUP (available 1877)
0 POLLIN POLLHUP (available 1877)
<content of myfile>
0 POLLHUP (available 0)
close

$ dart test.dart < myfile

0 POLLIN (available 348)
0 POLLIN (available 348)
<content of myfile>
0 POLLIN (available 0)
0 POLLIN (available 0)
0 POLLIN (available 0)
0 POLLIN (available 0)
<loops with 0 POLLIN (available 0) forever>

When "<" piping is used POLLHUP is not set.

The same happens on mac OS (except that for "|" piping POLLIN is set together with POLLHUP on the last event with 0 bytes available.

@sgjesse
Copy link
Contributor Author

sgjesse commented Dec 9, 2011

Fixed in https://code.google.com/p/dart/source/detail?r=2311.


Added Fixed label.

@sgjesse sgjesse added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. labels Dec 9, 2011
@sgjesse sgjesse self-assigned this Dec 9, 2011
copybara-service bot pushed a commit that referenced this issue Dec 9, 2022
Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (https://github.com/dart-lang/dartdoc/compare/4d7dc93..f2bb6e9):
  f2bb6e92  2022-12-07  Sam Rawlins  Bump to 6.1.4 (#3266)

fixnum (https://github.com/dart-lang/fixnum/compare/62916f2..e4f5e97):
  e4f5e97  2022-12-08  Michael Thomsen  Change IntegerDivisionByZeroException to UnsupportedError (#100)
  3bd726f  2022-12-08  Devon Carew  rev the sdk min to 2.19.0-0 (#99)

logging (https://github.com/dart-lang/logging/compare/f322480..0373ef8):
  0373ef8  2022-12-07  Mushaheed Syed  Add a check that throws if a logger name ends with '.' (#123)
  6d46d71  2022-12-06  Devon Carew  Create no-response.yml (#124)

protobuf (https://github.com/dart-lang/protobuf/compare/4f3e328..2706b53):
  2706b53  2022-12-07  Mahdi K. Fard  Add type to a method parameter (#782)
  a57c16a  2022-12-07  Mahdi K. Fard  Fix a typo (#781)

shelf (https://github.com/dart-lang/shelf/compare/1c21047..32e342d):
  32e342d  2022-12-08  István Soós  Prepare the release of shelf_router_generator (#316)
  06e2fe6  2022-12-08  Kevin Moore  shelf: drop non-null-safe tests (#317)
  98363fd  2022-12-06  Kevin Moore  lint: sort pub dependencies
  ad6af2a  2022-12-06  Kevin Moore  shelf_static: move RegExp creation out of every request

test (https://github.com/dart-lang/test/compare/4dceb87..73cd754):
  73cd7540  2022-12-07  Nate Bosch  Record the working directory for VM platform (#1804)
  e40274a6  2022-12-07  Nate Bosch  Restore mono_repo config (#1810)
  02d8764e  2022-12-07  Sigurd Meldgaard  Use Future for return type in runner `main()`. (#1809)
  3d6039b3  2022-12-05  Nate Bosch  Merge test selections by path (#1806)

webdev (https://github.com/dart-lang/webdev/compare/e39506e..3e2364e):
  3e2364e  2022-12-07  Elliott Brooks (she/her)  Add the Dart Debugger / Flutter Inspector panels in Chrome DevTools (#1812)
  c164231  2022-12-07  Elliott Brooks (she/her)  Small fix to the extension test (#1811)
  4bbb4d0  2022-12-06  Elliott Brooks (she/her)  Gracefully handle debugger disconnect events (#1808)
  d3892cf  2022-12-05  Elliott Brooks (she/her)  Refactor puppeteer tests to use `Worker` type (#1809)

Change-Id: I42033e849f40f209831cfb344247b24ad7731ff0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274580
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

1 participant