зеркало из https://github.com/microsoft/docker.git
Use ioutil.NopCloser instead of opening /dev/null for ReadCloser in CmdRun. Related to #31
This commit is contained in:
Родитель
f6d64738d0
Коммит
63edf8a4a1
|
@ -11,6 +11,7 @@ import (
|
||||||
"github.com/dotcloud/docker/image"
|
"github.com/dotcloud/docker/image"
|
||||||
"github.com/dotcloud/docker/rcli"
|
"github.com/dotcloud/docker/rcli"
|
||||||
"io"
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
@ -826,11 +827,8 @@ func (srv *Server) CmdRun(stdin io.ReadCloser, stdout io.Writer, args ...string)
|
||||||
// Find the image
|
// Find the image
|
||||||
img = srv.images.Find(name)
|
img = srv.images.Find(name)
|
||||||
if img == nil {
|
if img == nil {
|
||||||
devnull, err := os.Open("/dev/null")
|
stdin_noclose := ioutil.NopCloser(stdin)
|
||||||
if err != nil {
|
if srv.CmdPull(stdin_noclose, stdout, name) != nil {
|
||||||
return errors.New("Error opening /dev/null")
|
|
||||||
}
|
|
||||||
if srv.CmdPull(devnull, stdout, name) != nil {
|
|
||||||
return errors.New("Error downloading image: " + name)
|
return errors.New("Error downloading image: " + name)
|
||||||
}
|
}
|
||||||
img = srv.images.Find(name)
|
img = srv.images.Find(name)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче