-
Notifications
You must be signed in to change notification settings - Fork 647
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
Connect to stdin/stdout? #2038
Comments
The fact is that Go has enough abstraction layers to allow for stdio to be used instead of a TCP connection. The problem with that is that this implies a pair of handles to communicate, one in, and one out. Moreover, the |
I think you can create a custom connection within the something like this
and i believe any Duplex should work as the connection |
The change in #2675 by @murgatroid99 looks like it would allow a stdin/stdout pair wrapped as a Could be useful for parent/child process communication using an anonymous pipe. However I'm not too sure (new area for me) and I haven't tried it. |
I've implemented a stdio proof of concept here, using the aforementioned techniques on the client and server side. There is an explanation in the readme. It shows, as far as I can judge, that it is feasible to allow an arbitrary transport duplex stream. The client side technique however seems fragile - we are tricking the library into not going into the else block in @nicolasnoble - with that, and the two years since your last analysis, what do you think? Thanks |
I'm sorry but I am no longer working on the grpc project at Google. |
No worries, thanks. @murgatroid99 I see you're currently very active here. What do you think?
|
You linked to this issue instead of your proof of concept. If you're injecting the connection using credentials as mentioned in the earlier comment, that is an unintended hack that I wouldn't expect to be robust. The proper way would be to add a new public API to do this, similar to the connection injector API on the server, but I think it's not obvious what that should look like. |
Apologies, corrected the link now. Agreed. I'd be happy to think about the API and propose something, if that would be helpful as a first step to move this forward. Also happy to contribute beyond that. |
One option I see would be to introduce a new Another option is to add a channel argument that accepts the stream object. This would make it easier to use at the In either case, it might make sense to accept a stream factory function instead of a single stream, the way the http2 API does. |
1st:
As we're doing something custom for the comms channel, I think it's reasonable to expect some extra code around constructing 2nd:
This would require the ignoring of |
Is your feature request related to a problem? Please describe.
To be able to build a buildkit frontend, we have to connect to a GRPC server over stdin/stdout
https://github.com/moby/buildkit/blob/914e64243dbaa2ccb8798d732c6f7bafbb708eaa/frontend/gateway/grpcclient/client.go#L390-L392
https://github.com/moby/buildkit/blob/914e64243dbaa2ccb8798d732c6f7bafbb708eaa/frontend/gateway/grpcclient/client.go#L406-L408
However, I don't see how this should work with
@grpc/grpc-js
. Is there an easy way to pass streams to a Client / Channel so they can be used instead of an url?Describe the solution you'd like
A way to pass streams / an option to use stdin&stdout for the client as a channel
Describe alternatives you've considered
Extending a Channel and passing this to a client, but there doesn't seem an easy way to pass an input and output stream to
The text was updated successfully, but these errors were encountered: