mirror of
https://github.com/hashicorp/packer.git
synced 2026-05-28 04:35:38 -04:00
Prevent endless reading of closed file in vmware plugin
This commit is contained in:
parent
2eb80a81e3
commit
991cf22504
1 changed files with 3 additions and 2 deletions
|
|
@ -2,7 +2,6 @@ package common
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"math"
|
||||
"net"
|
||||
|
|
@ -1962,7 +1961,9 @@ func consumeFile(fd *os.File) (chan byte, sentinelSignaller) {
|
|||
b := make([]byte, 1)
|
||||
for {
|
||||
_, err := fd.Read(b)
|
||||
if err == io.EOF {
|
||||
if err != nil {
|
||||
// In case of any error we must stop
|
||||
// ErrClosed may appear since file is closed and this goroutine still left running
|
||||
break
|
||||
}
|
||||
fromfile <- b[0]
|
||||
|
|
|
|||
Loading…
Reference in a new issue