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

Cover output of spawned processes that inherit stdio #9

Open
medikoo opened this issue Aug 9, 2016 · 5 comments
Open

Cover output of spawned processes that inherit stdio #9

medikoo opened this issue Aug 9, 2016 · 5 comments

Comments

@medikoo
Copy link

medikoo commented Aug 9, 2016

It might be nice to somehow support that, at least via option.

Without that, output that hook-std captures doesn't necessary cover all output as seen from initialized process in a console.

I think it's possible only via overriding ChildProcess.prototype.spawn and act accordingly after recognizing the intention.

@medikoo medikoo changed the title Cover output of spawned processes that have inherited stdio Cover output of spawned processes that inherit stdio Aug 9, 2016
@sindresorhus
Copy link
Owner

I would like this too, but I don't think it's possible. From what I can remember, the stdio inheriting logic is done in native code in libuv, not in ChildProcess.prototype.spawn. But happy to be proven wrong in the form of a pull request 😀.

@medikoo
Copy link
Author

medikoo commented Aug 9, 2016

@sindresorhus I investigated it and indeed it looks there's no way. Still I would leave it open, maybe other adventurers will find some miraculous solution.

@sindresorhus
Copy link
Owner

Sure

@orta
Copy link

orta commented Feb 10, 2021

As a passer-by who hit this issue, I don't know if future folks have the same kind of problems as me (I wanted guarantees that I was getting pretty much the exact stdout/stderr with ASNI, but not spamming the console.)

What I did instead was use node-pty to spawn an in-memory pseudo-terminal which I could extract pretty much the exact same stdout/stderr.

@sindresorhus
Copy link
Owner

@orta Yup. That works, but node-pty is a native Node.js addon, which comes with all kinds of problems. It's not something I would depend on in a reusable package. If only Node.js had PTY built-in...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants