aboutsummaryrefslogtreecommitdiffstats
path: root/vm/vmm
diff options
context:
space:
mode:
Diffstat (limited to 'vm/vmm')
-rw-r--r--vm/vmm/vmm.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/vm/vmm/vmm.go b/vm/vmm/vmm.go
index 35fdf7650..5190e32b3 100644
--- a/vm/vmm/vmm.go
+++ b/vm/vmm/vmm.go
@@ -5,6 +5,7 @@
package vmm
import (
+ "context"
"fmt"
"io"
"os"
@@ -250,7 +251,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 {
@@ -281,9 +282,7 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin
go func() {
select {
- case <-time.After(timeout):
- signal(vmimpl.ErrTimeout)
- case <-stop:
+ case <-ctx.Done():
signal(vmimpl.ErrTimeout)
case err := <-inst.merger.Err:
cmd.Process.Kill()