aboutsummaryrefslogtreecommitdiffstats
path: root/vm/bhyve/bhyve.go
diff options
context:
space:
mode:
Diffstat (limited to 'vm/bhyve/bhyve.go')
-rw-r--r--vm/bhyve/bhyve.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/vm/bhyve/bhyve.go b/vm/bhyve/bhyve.go
index 74025e63d..6cccf7a9f 100644
--- a/vm/bhyve/bhyve.go
+++ b/vm/bhyve/bhyve.go
@@ -4,6 +4,7 @@
package bhyve
import (
+ "context"
"fmt"
"io"
"os"
@@ -324,7 +325,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 {
@@ -360,9 +361,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()