diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2016-01-20 14:01:45 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2016-01-20 14:01:45 +0100 |
| commit | 2fb5e9b0d49bb203026bf2f8cbeaa5c0aa306bb6 (patch) | |
| tree | 88d49c89ba25d2d381d905827ce9bc65ccebc98a | |
| parent | 8cff5843fb3bbbc1342cf3aafbff953f4477761f (diff) | |
vm/qemu: fix latent output reading bug
| -rw-r--r-- | vm/kvm/kvm.go | 6 | ||||
| -rw-r--r-- | vm/qemu/qemu.go | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/vm/kvm/kvm.go b/vm/kvm/kvm.go index 40add4604..2f1fb890b 100644 --- a/vm/kvm/kvm.go +++ b/vm/kvm/kvm.go @@ -217,8 +217,10 @@ func (inst *instance) Run(timeout time.Duration, command string) (<-chan []byte, signal := func(err error) { time.Sleep(3 * time.Second) // wait for any pending output inst.mu.Lock() - inst.outputB = nil - inst.outputC = nil + if inst.outputC == outputC { + inst.outputB = nil + inst.outputC = nil + } inst.mu.Unlock() errorC <- err } diff --git a/vm/qemu/qemu.go b/vm/qemu/qemu.go index 32af2d732..5571f2382 100644 --- a/vm/qemu/qemu.go +++ b/vm/qemu/qemu.go @@ -277,8 +277,10 @@ func (inst *instance) Run(timeout time.Duration, command string) (<-chan []byte, signal := func(err error) { time.Sleep(3 * time.Second) // wait for any pending output inst.mu.Lock() - inst.outputB = nil - inst.outputC = nil + if inst.outputC == outputC { + inst.outputB = nil + inst.outputC = nil + } inst.mu.Unlock() select { case errorC <- err: |
