aboutsummaryrefslogtreecommitdiffstats
path: root/vm/qemu
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/qemu
parent8f9cf946b3733d0b4ad3124bce155a4fc3849c3a (diff)
vm: func Run accepts context
It allows to use context as a single termination signal source.
Diffstat (limited to 'vm/qemu')
-rw-r--r--vm/qemu/qemu.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/vm/qemu/qemu.go b/vm/qemu/qemu.go
index 398eb8047..3fb78e9fb 100644
--- a/vm/qemu/qemu.go
+++ b/vm/qemu/qemu.go
@@ -5,6 +5,7 @@ package qemu
import (
"bytes"
+ "context"
"encoding/json"
"fmt"
"io"
@@ -667,7 +668,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) {
rpipe, wpipe, err := osutil.LongPipe()
if err != nil {
@@ -707,8 +708,7 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin
return nil, nil, err
}
wpipe.Close()
- return vmimpl.Multiplex(cmd, inst.merger, timeout, vmimpl.MultiplexConfig{
- Stop: stop,
+ return vmimpl.Multiplex(ctx, cmd, inst.merger, vmimpl.MultiplexConfig{
Debug: inst.debug,
Scale: inst.timeouts.Scale,
})