Skip to content

Commit

Permalink
client: Use io.Reader for Stdin in InstanceExecArgs
Browse files Browse the repository at this point in the history
This changes the Stdin field to be of type io.Reader instead of
io.ReadCloser.

Signed-off-by: Thomas Hipp <[email protected]>
  • Loading branch information
monstermunchkin committed Nov 16, 2023
1 parent 4b78dc7 commit ce2aad5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion client/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ type InstanceConsoleLogArgs struct {
// The InstanceExecArgs struct is used to pass additional options during instance exec.
type InstanceExecArgs struct {
// Standard input
Stdin io.ReadCloser
Stdin io.Reader

// Standard output
Stdout io.Writer
Expand Down
4 changes: 0 additions & 4 deletions client/lxd_instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -1287,10 +1287,6 @@ func (r *ProtocolLXD) ExecInstance(instanceName string, exec api.InstanceExecPos
}

if fds["0"] != "" {
if args.Stdin != nil {
_ = args.Stdin.Close()
}

// Empty the stdin channel but don't block on it as
// stdin may be stuck in Read()
go func() {
Expand Down
4 changes: 2 additions & 2 deletions shared/ws/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ func Mirror(conn *websocket.Conn, rwc io.ReadWriteCloser) (chan error, chan erro
return chRead, chWrite
}

// MirrorRead is a uni-directional mirror which replicates an io.ReadCloser to a websocket.
func MirrorRead(conn *websocket.Conn, rc io.ReadCloser) chan error {
// MirrorRead is a uni-directional mirror which replicates an io.Reader to a websocket.
func MirrorRead(conn *websocket.Conn, rc io.Reader) chan error {
chDone := make(chan error, 1)
if rc == nil {
close(chDone)
Expand Down

0 comments on commit ce2aad5

Please sign in to comment.