diff options
| author | Taras Madan <tarasmadan@google.com> | 2025-05-15 15:01:02 +0200 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2025-05-19 09:39:47 +0000 |
| commit | 27f689959decd391b047c8034d481267d500549e (patch) | |
| tree | 79ce6364d592fd6841e25ec64ca645fc3c65cdcf /vm/isolated/isolated.go | |
| parent | 8f9cf946b3733d0b4ad3124bce155a4fc3849c3a (diff) | |
vm: func Run accepts context
It allows to use context as a single termination signal source.
Diffstat (limited to 'vm/isolated/isolated.go')
| -rwxr-xr-x | vm/isolated/isolated.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/vm/isolated/isolated.go b/vm/isolated/isolated.go index eb70cf369..6e57fef9c 100755 --- a/vm/isolated/isolated.go +++ b/vm/isolated/isolated.go @@ -5,6 +5,7 @@ package isolated import ( "bytes" + "context" "fmt" "io" "os" @@ -311,7 +312,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) { args := append(vmimpl.SSHArgs(inst.debug, inst.Key, inst.Port, inst.cfg.SystemSSHCfg), inst.User+"@"+inst.Addr) @@ -354,9 +355,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, |
