Documentation
¶
Index ¶
- func ExecCmd(ctx context.Context, command string, args ...string) error
- func ExecCmdContainer(ctx context.Context, le *logrus.Entry, dockerClient client.APIClient, ...) error
- func InspectExecExit(ctx context.Context, inspector ExecInspector, execID string) error
- func NewInStream(in io.Reader, closeReader bool) io.ReadCloser
- func NewOutStream(le *logrus.Entry, out io.Writer) io.Writer
- type CommandExitError
- type CommonStream
- type ExecInspector
- type HijackedIOStreamer
- type InStream
- type OutStream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecCmdContainer ¶
func ExecCmdContainer( ctx context.Context, le *logrus.Entry, dockerClient client.APIClient, containerID string, userID string, stdIn io.Reader, stdOut io.Writer, stdErr io.Writer, cmd string, args ...string, ) error
ExecCmdContainer executes a command in a Docker container and returns its exit status.
func InspectExecExit ¶ added in v1.15.0
func InspectExecExit(ctx context.Context, inspector ExecInspector, execID string) error
InspectExecExit returns an error when the Docker exec process did not exit successfully.
func NewInStream ¶
func NewInStream(in io.Reader, closeReader bool) io.ReadCloser
NewInStream constructs an input stream around a reader.
Types ¶
type CommandExitError ¶ added in v1.15.0
type CommandExitError struct {
// contains filtered or unexported fields
}
CommandExitError reports a non-zero Docker exec exit status.
func NewCommandExitError ¶ added in v1.15.0
func NewCommandExitError(exitCode int) *CommandExitError
NewCommandExitError constructs an error for a non-zero Docker exec exit status.
func (*CommandExitError) Error ¶ added in v1.15.0
func (e *CommandExitError) Error() string
Error returns the command exit error message.
func (*CommandExitError) ExitCode ¶ added in v1.15.0
func (e *CommandExitError) ExitCode() int
ExitCode returns the Docker exec exit status.
type CommonStream ¶
type CommonStream struct {
// contains filtered or unexported fields
}
CommonStream tracks terminal state shared by input and output streams.
func (*CommonStream) FD ¶
func (s *CommonStream) FD() uintptr
FD returns the stream file descriptor.
func (*CommonStream) IsTerminal ¶
func (s *CommonStream) IsTerminal() bool
IsTerminal reports whether the stream is connected to a terminal.
func (*CommonStream) RestoreTerminal ¶
func (s *CommonStream) RestoreTerminal() error
RestoreTerminal restores the terminal mode saved by SetRawMode.
func (*CommonStream) SetIsTerminal ¶
func (s *CommonStream) SetIsTerminal(isTerminal bool)
SetIsTerminal overrides whether the stream is connected to a terminal.
func (*CommonStream) SetRawMode ¶
func (s *CommonStream) SetRawMode() error
SetRawMode places the terminal in raw mode.
type ExecInspector ¶ added in v1.15.0
type ExecInspector interface {
ContainerExecInspect(context.Context, string) (container.ExecInspect, error)
}
ExecInspector inspects the state of a Docker exec process.
type HijackedIOStreamer ¶
type HijackedIOStreamer struct {
InputStream io.ReadCloser
OutputStream io.Writer
ErrorStream io.Writer
Resp types.HijackedResponse
TTY bool
// contains filtered or unexported fields
}
HijackedIOStreamer copies input and output over a Docker hijacked connection.
func NewHijackedIOStreamer ¶ added in v1.15.0
func NewHijackedIOStreamer( le *logrus.Entry, resp types.HijackedResponse, useTTY bool, ) *HijackedIOStreamer
NewHijackedIOStreamer constructs a streamer for a Docker hijacked connection.
type InStream ¶
type InStream struct {
CommonStream
// contains filtered or unexported fields
}
InStream reads command input and optionally owns the underlying reader.
type OutStream ¶
type OutStream struct {
CommonStream
// contains filtered or unexported fields
}
OutStream writes command output and exposes terminal dimensions.
func (*OutStream) GetTTYSize ¶ added in v1.15.0
GetTTYSize returns the terminal height and width in characters.