aboutsummaryrefslogtreecommitdiffstats
path: root/vm/vmware/vmware.go
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2025-05-15 15:01:02 +0200
committerTaras Madan <tarasmadan@google.com>2025-05-19 09:39:47 +0000
commit27f689959decd391b047c8034d481267d500549e (patch)
tree79ce6364d592fd6841e25ec64ca645fc3c65cdcf /vm/vmware/vmware.go
parent8f9cf946b3733d0b4ad3124bce155a4fc3849c3a (diff)
vm: func Run accepts context
It allows to use context as a single termination signal source.
Diffstat (limited to 'vm/vmware/vmware.go')
-rw-r--r--vm/vmware/vmware.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/vm/vmware/vmware.go b/vm/vmware/vmware.go
index 104c3d6a9..e4379717b 100644
--- a/vm/vmware/vmware.go
+++ b/vm/vmware/vmware.go
@@ -4,6 +4,7 @@
package vmware
import (
+ "context"
"fmt"
"io"
"net"
@@ -173,7 +174,7 @@ func (inst *instance) Copy(hostSrc string) (string, error) {
return vmDst, nil
}
-func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command string) (
+func (inst *instance) Run(ctx context.Context, command string) (
<-chan []byte, <-chan error, error) {
vmxDir := filepath.Dir(inst.vmx)
serial := filepath.Join(vmxDir, "serial")
@@ -217,9 +218,8 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin
merger.Add("dmesg", dmesg)
merger.Add("ssh", rpipe)
- return vmimpl.Multiplex(cmd, merger, timeout, vmimpl.MultiplexConfig{
+ return vmimpl.Multiplex(ctx, cmd, merger, vmimpl.MultiplexConfig{
Console: dmesg,
- Stop: stop,
Close: inst.closed,
Debug: inst.debug,
Scale: inst.timeouts.Scale,