execserver: add protocol and handler for running remote commands - #2551
Draft
burgerdev wants to merge 1 commit into
Draft
execserver: add protocol and handler for running remote commands#2551burgerdev wants to merge 1 commit into
burgerdev wants to merge 1 commit into
Conversation
charludo
reviewed
Jul 29, 2026
| // | ||
| // It forwards stdin to the remote command, and pipes the remote output to the local writers. | ||
| // After the command completes, Run returns the exit code. | ||
| func Run(_ context.Context, log *slog.Logger, conn net.Conn, cmd []string, stdin io.Reader, stdout, stderr io.WriteCloser) (int, error) { |
Collaborator
There was a problem hiding this comment.
why ignore the Context here? Shouldn't cancellation also abort this function?
| // According to io.Reader, we might encounter n>0 and EOF in the same read. | ||
| if n > 0 { | ||
| if sendErr := WriteMessage(conn, &Request{Stdin: &StreamEvent{Data: buf[:n]}}); sendErr != nil { | ||
| log.Error("Encountered error while forwarding stdin", "error", err) |
Collaborator
There was a problem hiding this comment.
wrong error logged, same for the other two logs
| return | ||
| } | ||
| if len(req.Cmd) == 0 { | ||
| slog.Warn("First request did not contain a command") |
| } | ||
|
|
||
| // ErrMessageTooLarge is returned if the serialized message exceeds the maximum size. | ||
| var ErrMessageTooLarge = errors.New("message to large") |
Collaborator
There was a problem hiding this comment.
Suggested change
| var ErrMessageTooLarge = errors.New("message to large") | |
| var ErrMessageTooLarge = errors.New("message too large") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft: just the protocol for now, before I wire nix and image. Recommended reading order:
protocol.gocodec.goserver.go/handler.gorunner.go