Intercept calls to `stream.write`
See original GitHub issueSince Ink
rerenders the whole screen, message printed using process.stdout.write
will be gone. E.g. the message from node core when you attach more than 10 listeners to a single event.
It would be great if Ink could somehow intercept all calls to stream.write
except for its own and somehow store them.
Spitballing here, but maybe add it to StdoutContext
as an array or something? That way consumers can choose to have it as part of its output or not on its own.
If this is not something you want to do, it would be great of some separate ink-stream
module could encapsulate this logic (and ink renders via a special Symbol
or something so it can bypass the capture logic)
Related: console.log
etc can also mess up, but I think that’s outside the scope of this module
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:9 (9 by maintainers)
So is Ink 😃 It also uses
stdout.write
vialog-update
, so we’ll need some sort of way to figure out whether input is coming from Ink or not. I’ve started work on this using slightly modified https://yarnpkg.com/en/package/hook-std, will keep you posted. Feel free to also try it out yourself, if you want to 😉Sounds good, I can add that setting to disable Ink’s interception and release the interception code for console methods as a separate package, so you could reuse that.