Documentation
¶
Overview ¶
Package commandserver serves the executor CommandService over a Runner.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Exit ¶
type Exit struct {
Code int
// Confirmed reports that no process the command started is left running.
Confirmed bool
}
Exit is how a command ended.
type Option ¶
Option configures a Server.
func WithMaxCommandBytes ¶
WithMaxCommandBytes bounds the length of a command.
func WithMaxOutputBytes ¶
WithMaxOutputBytes bounds the combined stdout and stderr of a command.
func WithMaxTimeout ¶
WithMaxTimeout caps the timeout of every command.
type Process ¶
type Process interface {
// Wait returns after the command ends and its output has been written.
Wait() Exit
}
Process is a started command.
type Runner ¶
type Runner interface {
// Start returns once the command runs, or an error if it never ran.
// Ending ctx kills the command and every process it started.
Start(ctx context.Context, command string, stdout, stderr io.Writer) (Process, error)
}
Runner starts commands for the service.
type Server ¶
type Server struct {
executorv1.UnimplementedCommandServiceServer
// contains filtered or unexported fields
}
Server implements executorv1.CommandServiceServer.
func (*Server) RunCommand ¶
func (s *Server) RunCommand( stream grpc.BidiStreamingServer[executorv1.RunCommandRequest, executorv1.RunCommandResponse], ) error
RunCommand runs one command per stream.