From 63edf8a4a1830a939432e369dd075ebade0e03a9 Mon Sep 17 00:00:00 2001 From: Charles Hooper Date: Tue, 12 Mar 2013 03:18:34 +0000 Subject: [PATCH] Use ioutil.NopCloser instead of opening /dev/null for ReadCloser in CmdRun. Related to #31 --- server/server.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/server/server.go b/server/server.go index 4b73fec31c..17dc7705c4 100644 --- a/server/server.go +++ b/server/server.go @@ -11,6 +11,7 @@ import ( "github.com/dotcloud/docker/image" "github.com/dotcloud/docker/rcli" "io" + "io/ioutil" "net/http" "net/url" "os" @@ -826,11 +827,8 @@ func (srv *Server) CmdRun(stdin io.ReadCloser, stdout io.Writer, args ...string) // Find the image img = srv.images.Find(name) if img == nil { - devnull, err := os.Open("/dev/null") - if err != nil { - return errors.New("Error opening /dev/null") - } - if srv.CmdPull(devnull, stdout, name) != nil { + stdin_noclose := ioutil.NopCloser(stdin) + if srv.CmdPull(stdin_noclose, stdout, name) != nil { return errors.New("Error downloading image: " + name) } img = srv.images.Find(name)