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

Data returned from Process is not sent to output stream for java -version command #164

Closed
DartBot opened this issue Oct 18, 2011 · 3 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. closed-invalid Closed as we don't believe the reported issue is generally actionable os-osx

Comments

@DartBot
Copy link

DartBot commented Oct 18, 2011

This issue was originally filed by dartdeve...@gmail.com


What steps will reproduce the problem?

  1. Used a modified version of the example provided in issue155 (http://code.google.com/p/dart/issues/detail?id=155)

void main() {
  int BUF_LEN = 50;
  List<int> out = new List<int>();
  List<int> err = new List<int>();

  //Process p = new Process('ping', ['-c', '2', 'google.com']);// this works
  Process p = new Process('java', ['-version']);
  p.setExitHandler((int status) {
      print('exit($status)');
      print('OUT: -------------');
      print(new String.fromCharCodes(out));
      print('ERR: -------------');
      print(new String.fromCharCodes(err));
      p.close();
    });

  p.start();
  read(false, new List(BUF_LEN), p.stdoutStream, out);
  read(false, new List(BUF_LEN), p.stderrStream, err);
}

void processBuf(List<int> l, List<int> data) {
  data.addAll(l);
}

void read(bool fromCallback, List<int> buf, InputStream i, List<int> data) {
  if (fromCallback) {
    data.addAll(buf);
  }
  while(i.read(buf, 0, buf.length, () => read(true, buf, i, data))) {
    data.addAll(buf);
  }
}

What is the expected output? What do you see instead?
Actual output:

dart@dartvm~/dart: ./dart processtest.dart
exit(0)
OUT: -------------

ERR: -------------
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed

Expected output:
The output is sent to the error stream instead of output stream.

What version of the product are you using? On what operating system?
Max OSX 10.6.8

Please provide any additional information below.
If you uncomment the code that executes the ping command in a similar fashion, which works as expected, but java -version is exhibiting a different behavior. Am I missing anything here?

@DartBot
Copy link
Author

DartBot commented Oct 18, 2011

This comment was originally written by drfibonacci@google.com


Added Area-VM, OpSys-OSX, Triaged labels.

@iposva-google
Copy link
Contributor

This behaves as expected since "java -version" does print the version on stderr. See below when launching it from a bash shell.

$ java -version 1>stdout.txt 2>stderr.txt
$ cat stdout.txt
$ cat stderr.txt
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)
$


Added Invalid label.

@DartBot
Copy link
Author

DartBot commented Oct 18, 2011

This comment was originally written by dartdevel...@gmail.com


Ah, I did not expect java to redirect to stderr. thanks for catching that!

I was curious to run this program on Windows, but it failed with the following error and the program hangs, sounds like a totally different problem though.

C:\dart>dart_bin.exe processtest.dart
An unhandled exception has been thrown
SocketIOException: Error: readList failed - invalid socket handle
 0. Function: '_Socket@689f3ad.readList' url: './dart:builtin-lib' line:1160 col:5
 1. Function: 'SocketInputStream.read' url: './dart:builtin-lib' line:1260 col:27
 2. Function: 'read' url: 'processtest.dart' line:30 col:15
 3. Function: 'main' url: 'processtest.dart' line:18 col:7

C:\dart>
Pinging google.com [74.125.127.104] with 32 bytes of data:
Reply from 74.125.127.104: bytes=32 time=44ms TTL=46
Reply from 74.125.127.104: bytes=32 time=44ms TTL=46
Reply from 74.125.127.104: bytes=32 time=44ms TTL=46
Reply from 74.125.127.104: bytes=32 time=43ms TTL=46

Ping statistics for 74.125.127.104:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 43ms, Maximum = 44ms, Average = 43ms

@DartBot DartBot added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. os-osx closed-invalid Closed as we don't believe the reported issue is generally actionable labels Oct 18, 2011
dart-bot pushed a commit that referenced this issue Jan 7, 2021
Changes:
  63f1110 Make argument to featureValueOf dynamic (#164)
  71eeaee Make the item argument to Match dynamic again (#163)
  2071cfd Add types to more parameters (#162)
  5d52720 Allow null-safe code to do `same(null)`. (#161)
  05db35c Delete .test_config (#160)
  e8b4964 remove redundant experiment (#159)
  48fe280 Bump SDK constraints for pub (#158)
  225cc13 allow the 2.12 prerelease sdks (#157)
  b9ce574 Prepare for the 2.11 dev SDKs (#156)
  fe4e68a Update .travis.yml
Change-Id: I90c8d9d2f21d6454f1ace977deb9efec0d29d93d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177881
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
copybara-service bot pushed a commit that referenced this issue Oct 14, 2021
This is a reland of https://dart-review.googlesource.com/c/sdk/+/216184
that was reverted due to b/203034967

The new commit f0cb8f7 `Don't batch per default` works around the issue
(manually tested internally).

Changes:
```
> git log --format="%C(auto) %h %s" e0780cd..f0cb8f7
 https://dart.googlesource.com/usage.git/+/f0cb8f7 Don't batch per default (#164)
 https://dart.googlesource.com/usage.git/+/ac53249 Fix timeout (#162)
 https://dart.googlesource.com/usage.git/+/117d3a1 Allow sendRaw to send Map<String, dynamic> (#161)
 https://dart.googlesource.com/usage.git/+/016dd30 Prepare release (#160)
 https://dart.googlesource.com/usage.git/+/076c653 Merge pull request #152 from sigurdm/batching
 https://dart.googlesource.com/usage.git/+/1d6b343 Remove debug print
 https://dart.googlesource.com/usage.git/+/c073fb7 Use correct limit for bytes
 https://dart.googlesource.com/usage.git/+/1d89875 Send batch early if full
 https://dart.googlesource.com/usage.git/+/2896a85 Update README.md
 https://dart.googlesource.com/usage.git/+/da20fab Delete travis.sh
 https://dart.googlesource.com/usage.git/+/7c351a3 Merge
 https://dart.googlesource.com/usage.git/+/0424091 Update build.yaml (#159)
 https://dart.googlesource.com/usage.git/+/4f2a050 Use a Duration for batching delay
 https://dart.googlesource.com/usage.git/+/aa3f3ce address review
 https://dart.googlesource.com/usage.git/+/318ebe5 Fix
 https://dart.googlesource.com/usage.git/+/71ddec1 Send remaining hits on waitForLastPing
 https://dart.googlesource.com/usage.git/+/1c895a7 Parametrize client-id in test
 https://dart.googlesource.com/usage.git/+/0ae7733 Fix pubspec
 https://dart.googlesource.com/usage.git/+/2255b3d Merge remote-tracking branch 'origin/master' into batching
 https://dart.googlesource.com/usage.git/+/14d3702 Merge remote-tracking branch 'origin/master' into batching
 https://dart.googlesource.com/usage.git/+/1c3393d Handle batching implicit waiting for a 'batchDelay' future
 https://dart.googlesource.com/usage.git/+/219b764 TODO about size of payloads
 https://dart.googlesource.com/usage.git/+/aaee6d9 Fix AnalyticsMock
 https://dart.googlesource.com/usage.git/+/a8ec5b4 Remove mockito as dep - didn't use it
 https://dart.googlesource.com/usage.git/+/e26fcce Allow batching of hits

```

Diff: https://dart.googlesource.com/usage.git/+/e0780cd8b2f8af69a28dc52678ffe8492da27d06~..f0cb8f7cce8b675255c81488dbab8cf9f2f56404/
Change-Id: Iccac84c5182953209d7c05ac47cbde82e59a590d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216803
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
copybara-service bot pushed a commit that referenced this issue Feb 6, 2023
Also rev package:csslib and package:html.


csslib (https://github.com/dart-lang/csslib/compare/7054945..f33d632):
  f33d632  2023-01-28  Devon Carew  switch to using package:dart_flutter_team_lints (#161)
  c0097a0  2023-01-28  Devon Carew  Update README.md (#158)
  0d985fb  2023-01-28  dependabot[bot]  Bump dart-lang/setup-dart from 1.3 to 1.4 (#164)
  56d1152  2023-01-28  dependabot[bot]  Bump actions/checkout from 3.2.0 to 3.3.0 (#163)
  46d2c57  2023-01-28  Devon Carew  Update test-package.yml (#165)
  a7d17bc  2023-01-26  Kevin Moore  all the cleanup (#155)

html (https://github.com/dart-lang/html/compare/3dd00b0..f118e00):
  f118e00  2023-01-30  Devon Carew  lint with dart_flutter_team_lints (#201)
  52d9185  2023-01-30  Devon Carew  updates from #158 (#202)
  71d3e71  2023-01-30  Ron Booth  fixed issue #157 (querySelector fails), and added test for it (#158)
  9ab8b28  2023-01-30  dependabot[bot]  Bump actions/checkout from 3.2.0 to 3.3.0 (#200)
  fe3fbf6  2023-01-30  dependabot[bot]  Bump dart-lang/setup-dart from 1.3 to 1.4 (#199)
  776daf5  2023-01-30  Devon Carew  Update test-package.yml (#198)
  a5be27f  2023-01-27  Devon Carew  finish work for avoid_dynamic_calls (#196)

Change-Id: If03552028f30b8dfd6a227674aa161e43a05e11f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280129
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Sigurd Meldgaard <sigurdm@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
copybara-service bot pushed a commit that referenced this issue Sep 12, 2023
Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (https://github.com/dart-lang/dartdoc/compare/f5750f5..dd28f4c):
  dd28f4ce  2023-09-11  dependabot[bot]  Bump actions/cache from 3.3.1 to 3.3.2 (#3497)
  2ac7e323  2023-09-11  dependabot[bot]  Bump actions/upload-artifact from 3.1.2 to 3.1.3 (#3496)

ecosystem (https://github.com/dart-lang/ecosystem/compare/2e6c3ec..e96fbdb):
  e96fbdb  2023-09-12  Moritz  Try a fix for the health check socket issues (#164)
  4cc5005  2023-09-11  Alexander Thomas  Add missing license header to license.dart (#166)
  3fbab6c  2023-09-10  Moritz  Fix boolean condition in `publish.yaml` (#163)

http (https://github.com/dart-lang/http/compare/7fb6fd6..de19214):
  de19214  2023-09-12  Sam Rawlins  Avoid passing a nullable value to Completer<nn-type>.complete (#1015)

native (https://github.com/dart-lang/native/compare/a2dfedc..5177659):
  5177659  2023-09-12  Daco Harkes  [native_assets_builder] Speedup builds for 0 or 1 packages with native assets (#129)
  7f30f4b  2023-09-12  Daco Harkes  [native_assets_builder] Take packageLayout for build and dryRun (#127)
  a7cd31e  2023-09-12  Daco Harkes  `PackageLayout` constructor for already parsed `PackageConfig` (#126)
  9f24b64  2023-09-11  Daco Harkes  [native_toolchain_c] Fix MSVC x86 toolchain resolution (#124)
  07e1de5  2023-09-06  Daco Harkes  Reenable example on CI + roll dep (#122)
  387f894  2023-09-06  Gabriel Terwesten  [native_toolchain_c] Default handling for PIC/PIE compiler flags (#121)
  0a4e5f8  2023-09-06  Gabriel Terwesten  Add support for defines to `CBuilder` (#120)

test (https://github.com/dart-lang/test/compare/27dcae1..6449495):
  64494959  2023-09-11  Jacob MacDonald  skip failing wasm tests (#2091)
  83ae0d9f  2023-09-07  Jacob MacDonald  Fix running browser tests that use deferred loading (#2090)

tools (https://github.com/dart-lang/tools/compare/2c8cbd6..fa01f9b):
  fa01f9b  2023-09-11  Elias Yishak  `--disable-telemetry` --> `--disable-analytics` (#145)

webdev (https://github.com/dart-lang/webdev/compare/9487a45..6b21ecf):
  6b21ecf0  2023-09-11  dependabot[bot]  Bump actions/labeler from 4.2.0 to 4.3.0 (#2177)
  78a5fece  2023-09-11  Sam Rawlins  Avoid passing a nullable value to Future<nn-type>.value or Completer<nn-type>.completer. (#2205)
  6f282432  2023-09-11  Parker Lougheed  [webdev] Hide `--null-safety` option (#2206)
  1c5a7bc7  2023-09-11  Parker Lougheed  Replace deprecated lints (#2208)
  f0656b4a  2023-09-11  Parker Lougheed  Fix a few minor spelling mistakes (#2209)
  158223b2  2023-09-11  Parker Lougheed  Update old dartlang.org links to new .dev equivalents (#2210)
  a8d114c5  2023-09-11  Elliott Brooks  Update the comment for lookupResolvedPackageUris
  76e050c6  2023-09-11  Elliott Brooks  Clear the map of relative URIs on DartUri.clear()
  38a17ced  2023-09-11  dependabot[bot]  Bump dart-lang/setup-dart from 1.3.0 to 1.5.0 (#2212)
  cca9e56d  2023-09-11  Elliott Brooks  Reset Webdev after release (#2227)
  824dcef7  2023-09-11  Elliott Brooks  Reset DWDS after release (#2225)
  45c09a80  2023-09-08  Elliott Brooks  Prepare Webdev for release to 3.0.8 (#2224)
  805d3b7e  2023-09-08  dependabot[bot]  Bump actions/cache from 3.2.2 to 3.3.2 (#2223)
  85d4e760  2023-09-08  Elliott Brooks  Prepare DWDS for release to version 21.0.0 (#2221)
  a3757f06  2023-09-08  Anna Gringauze  Run monorepo generate (#2222)
  c991e85a  2023-09-07  dependabot[bot]  Bump actions/checkout from 3.2.0 to 4.0.0 (#2219)
  9851c23c  2023-09-07  Parker Lougheed  Update SDK constraints for Dart 3.0 and 3.1 stable releases (#2207)

Change-Id: I0caf74af171916d30eb8ee2ab78c15acaebaa229
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325560
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
copybara-service bot pushed a commit that referenced this issue Oct 24, 2023
Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (https://github.com/dart-lang/dartdoc/compare/f7e9b17..53da3e1):
  53da3e1d  2023-10-23  dependabot[bot]  Bump actions/checkout from 4.1.0 to 4.1.1 (#3544)
  62d5469d  2023-10-23  Sam Rawlins  Support extension types in sidebars and categories (#3537)
  69abd0f0  2023-10-22  Sam Rawlins  Refactor file-gathering logic (#3539)
  e9c61d1d  2023-10-22  Sam Rawlins  Convert some late final fields to getters in Accessor, Annotation, Constructor (#3534)
  adcdc8b7  2023-10-20  Parker Lougheed  Update package:lints to v3 (#3542)
  41f02622  2023-10-19  Sam Rawlins  Greatly simplify ModelCommentReference (#3541)
  50e4b679  2023-10-19  Sam Rawlins  Remove use of NodeLocator2 (#3538)
  b2de813c  2023-10-19  Sam Rawlins  Remove support for deprecated leading new in comment references (#3529)
  b350c688  2023-10-19  Sam Rawlins  Bump to 7.0.1 (#3540)
  5256e2fb  2023-10-19  Sam Rawlins  Remove unused warnings (#3533)

lints (https://github.com/dart-lang/lints/compare/975c687..2cf8403):
  2cf8403  2023-10-23  Devon Carew  add no_wildcard_variable_uses; rev to a new major version (#165)
  7b0f556  2023-10-23  Parker Lougheed  Remove mention of no_wildcard_variable_uses from changelog (#164)

matcher (https://github.com/dart-lang/matcher/compare/356e5f6..7512f80):
  7512f80  2023-10-23  Michael Goderbauer  Specify language in neverCalled docs for nicer formatting in docs (#230)

protobuf (https://github.com/dart-lang/protobuf/compare/050c162..3528fad):
  3528fad  2023-10-24  Ömer Sinan Ağacan  Use `setRange` when copying output chunks to the final buffer in `CodedBufferWriter` (#887)

tools (https://github.com/dart-lang/tools/compare/15cc9c7..da6bb18):
  da6bb18  2023-10-24  Elias Yishak  Enum + event constructors added for doctor events (#178)
  e3dd149  2023-10-24  Elias Yishak  Use futures list internally to manage send events (#184)

webdev (https://github.com/dart-lang/webdev/compare/1bd434b..6e324af):
  6e324afb  2023-10-24  Ben Konyi  Add dependency on `package:vm_service_interface` (#2262)
  8429a79f  2023-10-20  Elliott Brooks  Only notify chatroom when daily stable testing fails (#2259)
  3463d169  2023-10-19  Elliott Brooks  Remove Chrome 115 extension error (#2258)
  fdebc06e  2023-10-19  Elliott Brooks  Reset Webdev to 3.2.0-wip after release (#2260)
  9cffb896  2023-10-19  Elliott Brooks  Reset DWDS to 22.1.0-wip after release (#2256)
  07c70c6c  2023-10-19  Elliott Brooks  Prepare Webdev for release to 3.1.0 (#2255)

Change-Id: Ieae3aadcc804a270867d7935b702987cf1f6d51c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332060
Reviewed-by: Elias Yishak <eliasyishak@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
copybara-service bot pushed a commit that referenced this issue Oct 31, 2023
Revisions updated by `dart tools/rev_sdk_deps.dart`.

lints (https://github.com/dart-lang/lints/compare/2cf8403..5c60f48):
  5c60f48  2023-10-30  Michael Goderbauer  Update README.md to use new syntax for adding dev dependencies (#167)

mockito (https://github.com/dart-lang/mockito/compare/4edf86f..b7d752e):
  b7d752e  2023-10-26  Ilya Yanok  Use Dart SDK 3.1.0 for format check
  ca537db  2023-10-26  Ilya Yanok  Remove unneeded deprecation warning disable comment
  1a0d0e7  2023-10-26  Ilya Yanok  Remove deprecated `returnNullOnMissingStub` and `OnMissingStub.returnNull`

native (https://github.com/dart-lang/native/compare/757f503..279094d):
  279094d  2023-10-30  Pierrick Bouvier  [native_toolchain_c] Support MSVC arm64 toolchain (#167)
  9629a55  2023-10-27  Parker Lougheed  Allow modification of a BuildOutput's raw dependencies (#169)
  762b4da  2023-10-27  Ryan Macnak  [native_assets_cli] Add Android RISCV64 target. (#166)
  18bff8c  2023-10-25  Ryan Macnak  [native_toolchain_c] Setup Linux X64 toolchain for non-X64 hosts. (#164)
  d79a7cd  2023-10-25  Ryan Macnak  [native_toolchain_c] Setup Linux RISCV64 toolchain. (#163)
  ce26f75  2023-10-25  Parker Lougheed  Update all lints and dart_flutter_team_lints dependencies (#161)

protobuf (https://github.com/dart-lang/protobuf/compare/3528fad..3f567b2):
  3f567b2  2023-10-27  Ömer Sinan Ağacan  Remove the dynamic call in `CodedBufferWriter` (#895)
  42436cd  2023-10-26  Ömer Sinan Ağacan  Keep a `ByteData` around in `CodedBufferReader` to avoid repeated `ByteData` allocs (#890)
  9a73936  2023-10-26  Ömer Sinan Ağacan  Avoid adding empty splices in `CodedBufferWriter` (#886)
  23dffde  2023-10-26  Ömer Sinan Ağacan  Update a bug link in a comment (#892)
  19903f0  2023-10-26  Ömer Sinan Ağacan  Make `CodedBufferWriter.writeRawByte` argument type more accurate (#891)
  2ce3e14  2023-10-26  Ömer Sinan Ağacan  Update `FieldInfo._ensureRepeatedField` return type (#893)
  e146515  2023-10-25  Ömer Sinan Ağacan  Avoid redundant ByteData allocation when decoding sfixed64 (#889)
  1b1d549  2023-10-25  Ömer Sinan Ağacan  Avoid allocating temporary views in when decoding strings in `CodedBufferReader` (#888)

tools (https://github.com/dart-lang/tools/compare/da6bb18..e828d45):
  e828d45  2023-10-27  Elias Yishak  Create tests for each event constructor (#186)

webdev (https://github.com/dart-lang/webdev/compare/25f17cd..50534a1):
  50534a12  2023-10-30  Elliott Brooks  Cider passes an app ID instead of a workspace name to connect to the Dart Debug Extension (#2272)
  b3d6ef14  2023-10-27  Elliott Brooks  Expose a keyboard shortcut to copy the Dart app ID (#2271)
  c26b4e5f  2023-10-27  Elliott Brooks  Reset Webdev to 3.3.0-wip after release (#2269)
  982b955b  2023-10-26  Elliott Brooks  Prepare webdev for 3.2.0  (#2268)
  62361fbf  2023-10-26  Elliott Brooks  Reset DWDS after release (#2267)
  50b8ae86  2023-10-26  Elliott Brooks  Prepare DWDS for release to version 22.1.0 (#2266)

Change-Id: Ia02db3bc66bac55b637ed5e173fe5c5d50bcca52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332748
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@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, FFI, and the AOT and JIT backends. closed-invalid Closed as we don't believe the reported issue is generally actionable os-osx
Projects
None yet
Development

No branches or pull requests

2 participants