Skip to content

Commit

Permalink
[lxd-import] client: ws.Mirror*() usage
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
  • Loading branch information
tomponline authored and stgraber committed Oct 16, 2023
1 parent 2259e37 commit 01264bb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions client/incus_instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -1211,8 +1211,8 @@ func (r *ProtocolIncus) ExecInstance(instanceName string, exec api.InstanceExecP

// And attach stdin and stdout to it
go func() {
ws.MirrorRead(context.Background(), conn, args.Stdin)
<-ws.MirrorWrite(context.Background(), conn, args.Stdout)
ws.MirrorRead(conn, args.Stdin)
<-ws.MirrorWrite(conn, args.Stdout)
_ = conn.Close()

if args.DataDone != nil {
Expand All @@ -1237,7 +1237,7 @@ func (r *ProtocolIncus) ExecInstance(instanceName string, exec api.InstanceExecP
}

conns = append(conns, conn)
dones[0] = ws.MirrorRead(context.Background(), conn, args.Stdin)
dones[0] = ws.MirrorRead(conn, args.Stdin)
}

// Handle stdout
Expand All @@ -1248,7 +1248,7 @@ func (r *ProtocolIncus) ExecInstance(instanceName string, exec api.InstanceExecP
}

conns = append(conns, conn)
dones[1] = ws.MirrorWrite(context.Background(), conn, args.Stdout)
dones[1] = ws.MirrorWrite(conn, args.Stdout)
}

// Handle stderr
Expand All @@ -1259,7 +1259,7 @@ func (r *ProtocolIncus) ExecInstance(instanceName string, exec api.InstanceExecP
}

conns = append(conns, conn)
dones[2] = ws.MirrorWrite(context.Background(), conn, args.Stderr)
dones[2] = ws.MirrorWrite(conn, args.Stderr)
}

// Wait for everything to be done
Expand Down Expand Up @@ -2463,7 +2463,7 @@ func (r *ProtocolIncus) ConsoleInstance(instanceName string, console api.Instanc

// And attach stdin and stdout to it
go func() {
_, writeDone := ws.Mirror(context.Background(), conn, args.Terminal)
_, writeDone := ws.Mirror(conn, args.Terminal)
<-writeDone
_ = conn.Close()
}()
Expand Down Expand Up @@ -2550,7 +2550,7 @@ func (r *ProtocolIncus) ConsoleInstanceDynamic(instanceName string, console api.
}

// Attach reader/writer.
_, writeDone := ws.Mirror(context.Background(), conn, rwc)
_, writeDone := ws.Mirror(conn, rwc)
<-writeDone
_ = conn.Close()

Expand Down

0 comments on commit 01264bb

Please sign in to comment.