Merge pull request #30139 from Microsoft/jjh/sequential

Windows: Use sequential file access
This commit is contained in:
Aaron Lehmann 2017-01-23 12:46:06 -08:00 committed by GitHub
commit 9f0e5f7e1f
1 changed files with 5 additions and 2 deletions

View File

@ -3,16 +3,19 @@ package command
import ( import (
"fmt" "fmt"
"io" "io"
"io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"runtime" "runtime"
"strings" "strings"
"github.com/docker/docker/pkg/system"
) )
// CopyToFile writes the content of the reader to the specified file // CopyToFile writes the content of the reader to the specified file
func CopyToFile(outfile string, r io.Reader) error { func CopyToFile(outfile string, r io.Reader) error {
tmpFile, err := ioutil.TempFile(filepath.Dir(outfile), ".docker_temp_") // We use sequential file access here to avoid depleting the standby list
// on Windows. On Linux, this is a call directly to ioutil.TempFile
tmpFile, err := system.TempFileSequential(filepath.Dir(outfile), ".docker_temp_")
if err != nil { if err != nil {
return err return err
} }