Skip to content

pub [global] run doesn't redirect stdout/stderr? #4

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

Closed
DartBot opened this issue Jun 4, 2015 · 6 comments
Closed

pub [global] run doesn't redirect stdout/stderr? #4

DartBot opened this issue Jun 4, 2015 · 6 comments
Labels
needs-info Additional information needed from the issue author type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@DartBot
Copy link

DartBot commented Jun 4, 2015

<img src="https://avatars.githubusercontent.com/u/444270?v=3" align="left" width="96" height="96"hspace="10"> Issue by seaneagan
Originally opened as dart-lang/sdk#23072


Tried doing:

pub run unittest:unittest > out.txt

The output gets printed to the console, and not to out.txt. Presumably pub run is not redirecting the stdout/stderr of the dart script it is running to its own stdout/stderr?

I'm on windows.

@DartBot DartBot added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) needs-info Additional information needed from the issue author labels Jun 4, 2015
@DartBot
Copy link
Author

DartBot commented Jun 4, 2015

<img src="https://avatars.githubusercontent.com/u/405837?v=3" align="left" width="48" height="48"hspace="10"> Comment by zoechi


Probably similar to http://dartbug.com/21049

@DartBot
Copy link
Author

DartBot commented Jun 4, 2015

<img src="https://avatars.githubusercontent.com/u/405837?v=3" align="left" width="48" height="48"hspace="10"> Comment by zoechi


And probably a workaround for http://dartbug.com/21564 which should be fixed.

@DartBot
Copy link
Author

DartBot commented Jun 4, 2015

<img src="https://avatars.githubusercontent.com/u/444270?v=3" align="left" width="48" height="48"hspace="10"> Comment by seaneagan


I don't think it matters if the output of the process spawned by pub run is written synchonously or not, it should still be capturable by the calling process (pub run) via something like:

  Process.start(...)
    ..stdout.listen(stdout.write);
    ..stderr.listen(stderr.write);

Is pub [global] run already doing something like that?

@DartBot
Copy link
Author

DartBot commented Jun 4, 2015

<img src="https://avatars.githubusercontent.com/u/444270?v=3" align="left" width="48" height="48"hspace="10"> Comment by seaneagan


Actually, there's an example right in the docs for Process.start:

Process.start('grep', ['-i', 'main', 'test.dart']).then((process) {
  stdout.addStream(process.stdout);
  stderr.addStream(process.stderr);
});

@DartBot
Copy link
Author

DartBot commented Jun 4, 2015

<img src="https://avatars.githubusercontent.com/u/5449880?v=3" align="left" width="48" height="48"hspace="10"> Comment by iposva-google


Added Area-Pub, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Jun 4, 2015

<img src="https://avatars.githubusercontent.com/u/188?v=3" align="left" width="48" height="48"hspace="10"> Comment by nex3


I can't reproduce this on Linux. It's piping the output just fine for me. What version of the SDK are you using? Can you reproduce this with a simple print statement in a script run via "pub run"? How about not run via "pub run"? Can you pipe just the stderr using "2>"?


Added NeedsInfo label.

@nex3 nex3 closed this as completed Dec 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-info Additional information needed from the issue author type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

2 participants