Skip to content

Add a --stream option to the run command#608

Merged
hzoo merged 2 commits intolerna:masterfrom
gigabo:run-stream
Feb 28, 2017
Merged

Add a --stream option to the run command#608
hzoo merged 2 commits intolerna:masterfrom
gigabo:run-stream

Conversation

@gigabo
Copy link
Copy Markdown
Contributor

@gigabo gigabo commented Feb 18, 2017

Emit output from child processes immediately.

  • Each line is prefixed with the name of the originating package.
  • Output from stdout goes to stdout, and stderr goes to stderr.
$ lerna run watch --stream

This closes #446.

Emit output from child processes immediately.

- Each line is prefixed with the name of the originating package.
- Output from stdout goes to stdout, and stderr goes to stderr.

```sh
$ lerna run watch --stream
```

This closes lerna#446.
Also simplify partial line handling.
Copy link
Copy Markdown
Contributor

@cif cif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This. Is. Awesome.

@leonardorb
Copy link
Copy Markdown

That's great! This will be very helpful.

@hzoo hzoo merged commit 2f3b195 into lerna:master Feb 28, 2017

static spawnStreaming(command, args, opts, prefix, callback) {
opts = Object.assign({}, opts, {
stdio: ["ignore", "pipe", "pipe"],
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi. Sorry to bother you on such an old PR but I am curious about the motivation for ignoring stdin? I understand that it could not really make sense in some case (that I don't have in mind - I am not an stdin/out professional), but I am facing an issue and switching ignore with pipe or inherit seems to change nothing in most case but could help me with my issue.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the biggest problem with "inherit" is in concurrent execution: which process "gets" to have stdin, should it be necessary? Imagine 8 concurrent npm executions demanding a one-time password, for example.

I am sympathetic to this, but I think we would need an option, like --inherit-stdin, to explicitly enable this in both lerna exec and lerna run. Open questions:

  • Should --inherit-stdin imply --stream?
  • Should --inherit-stdin be allowed if --parallel is enabled?

There are two options, as I see it, to avoid the interleaved/conflicting stdin problem:

  1. --inherit-stdin implicitly restricts concurrency to 1
  2. Recommend --concurrency 1 in docs, warn loudly when this.concurrency !== 1

@lock
Copy link
Copy Markdown

lock Bot commented Dec 27, 2018

This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators Dec 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show immediate log output of npm scripts

6 participants