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

Bun Shell $: line by line stderr output #8857

Open
DavertMik opened this issue Feb 12, 2024 · 4 comments
Open

Bun Shell $: line by line stderr output #8857

DavertMik opened this issue Feb 12, 2024 · 4 comments
Labels
enhancement New feature or request shell Something to do with Bun as a shell

Comments

@DavertMik
Copy link

What is the problem this feature would solve?

Many processes like docker build or npm run build print output to stderr. To collect realtime stdout inside Bun Shell I can use

for await (let line of $`docker build`.lines()) {

However, these lines don't include stderr. It would be nice to receive stderr output as it can be as valuable as stdout

What is the feature you are proposing to solve the problem?

lines method can take options what output to handle

for await (let line of $`docker build`.lines({  stdout: true, stderr: true })) {

What alternatives have you considered?

Using pipes or using Bun.spawn but I prefer to see this as part of Bun Shell because I really like this feature

@DavertMik DavertMik added the enhancement New feature or request label Feb 12, 2024
@DavertMik DavertMik changed the title Bun Shell $: lime by lime stderr output Bun Shell $: lime by line stderr output Feb 12, 2024
@DavertMik DavertMik changed the title Bun Shell $: lime by line stderr output Bun Shell $: line by line stderr output Feb 12, 2024
@Electroid Electroid added the shell Something to do with Bun as a shell label Feb 12, 2024
@zackradisic
Copy link
Contributor

We could add: .lines({ stdout, stderr }) and also we plan to support redirecting stderr to stdout (2>&1) to achieve this as well

@DavertMik
Copy link
Author

That would be great, thanks @zackradisic

@DavertMik
Copy link
Author

Any plans to ship it in next Bun releases?

@DavertMik
Copy link
Author

DavertMik commented Jun 15, 2024

I also tried to use the following:

for await (let line of $(`docker build . 2>&1`).lines()) {

however, even I redirected all stderr to stdout, I don't see that output is printer by lines. The output is printed only in the end of command execution.

Is there a way to interactively receive all output line by line?

Is this feature planned in Bun?

@zackradisic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request shell Something to do with Bun as a shell
Projects
None yet
Development

No branches or pull requests

3 participants