@@ -80,19 +80,19 @@ func (v *Virt) ExecAttach(ctx context.Context, execID string, tty bool) (io.Read
80
80
}
81
81
82
82
// Execute executes a command in vm
83
- func (v * Virt ) Execute (ctx context.Context , target string , config * enginetypes.ExecConfig ) (_ string , outputStream io.ReadCloser , inputStream io.WriteCloser , err error ) {
83
+ func (v * Virt ) Execute (ctx context.Context , target string , config * enginetypes.ExecConfig ) (execID string , outputStream io.ReadCloser , inputStream io.WriteCloser , err error ) {
84
84
if config .Tty {
85
85
flags := virttypes.AttachGuestFlags {Safe : true , Force : true }
86
86
stream , err := v .client .AttachGuest (ctx , target , flags )
87
87
if err != nil {
88
88
return "" , nil , nil , err
89
89
}
90
- return "" , ioutil .NopCloser (stream ), stream , nil
90
+ return target , ioutil .NopCloser (stream ), stream , nil
91
91
92
92
}
93
93
94
94
msg , err := v .client .ExecuteGuest (ctx , target , config .Cmd )
95
- return "" , ioutil .NopCloser (bytes .NewReader (msg .Data )), nil , err
95
+ return target , ioutil .NopCloser (bytes .NewReader (msg .Data )), nil , err
96
96
97
97
}
98
98
@@ -103,7 +103,10 @@ func (v *Virt) ExecExitCode(ctx context.Context, execID string) (code int, err e
103
103
104
104
// ExecResize resize exec tty
105
105
func (v * Virt ) ExecResize (ctx context.Context , execID string , height , width uint ) (err error ) {
106
- return nil
106
+ resizeCmd := fmt .Sprintf ("/bin/stty -F /dev/ttyS0 rows %d cols %d" , height , width )
107
+ msg , err := v .client .ExecuteGuest (ctx , execID , strings .Split (resizeCmd , " " ))
108
+ log .Debugf ("[ExecResize] resize got response: %v" , msg )
109
+ return err
107
110
}
108
111
109
112
// NetworkConnect connects to a network.
0 commit comments