question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Intercept calls to `stream.write`

See original GitHub issue

Since 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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
vadimdemedescommented, Mar 21, 2019

So is Ink 😃 It also uses stdout.write via log-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 😉

1reaction
vadimdemedescommented, May 23, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to intercept & custom process stream chunks ...
The easies thing you could do is to just subscribe at 'data' event and simply count the occurrences like this:.
Read more >
gRPC interceptors on .NET
gRPC client interceptors intercept outgoing RPC invocations. ... Intercepts an asynchronous invocation of a server-streaming RPC.
Read more >
intercept
routeMatcher is an object used to match the incoming HTTP requests with this intercepted route. All properties are optional but all those that...
Read more >
Using Postman Interceptor
Interceptor enables you to capture network requests and cookies ... Confirm that you have permissions to delete, write, and execute in the ...
Read more >
Cypress cy.intercept Problems
The command cy.intercept can match requests using a substring, a minimatch, or a regular expression. By default, it intercepts requests matching ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found