docker save: Do not save to a terminal.#8321
Conversation
There was a problem hiding this comment.
could this be it's own test or no? just wondering
There was a problem hiding this comment.
oh nm then we would have to make the repo again
There was a problem hiding this comment.
Yeah, that’s why I did it this way.
On Sep 30, 2014, at 5:51 PM, Jessie Frazelle [email protected] wrote:
In integration-cli/docker_cli_save_load_test.go:
@@ -60,6 +63,33 @@ func TestSaveAndLoadRepoStdout(t *testing.T) {
logDone("save - save a repo using stdout") logDone("load - load a repo using stdout")
oh nm then we would have to make the repo again
—
Reply to this email directly or view it on GitHub.
|
LGTM |
|
I guess you can do the same on export ? |
|
Yep! On Sep 30, 2014, at 6:32 PM, Victor Vieux [email protected] wrote:
|
|
are we waiting on export or should there be a new PR for that? |
|
Let's make a new PR for it. I'll put it on my task list. |
|
LGTM |
There was a problem hiding this comment.
@erikh
Let's try to use the bytes package wherever possible. Also, buf has 1024 length even if Read did not read 1024 bytes. I suggest the following:
n, err := pty.Read(buf)
if err != nil { ... }
if !bytes.Contains(buf[:n], []byte("Cowardly refusing")) { ... }There was a problem hiding this comment.
Updated.
On Oct 6, 2014, at 9:01 AM, Tibor Vass [email protected] wrote:
In integration-cli/docker_cli_save_load_test.go:
- cmd.Stdout = tty
- cmd.Stderr = tty
- if err := cmd.Start(); err != nil {
t.Fatalf("start err: %v", err)- }
- if err := cmd.Wait(); err == nil {
t.Fatal("did not break writing to a TTY")- }
- buf := make([]byte, 1024)
- if _, err := pty.Read(buf); err != nil {
t.Fatal("could not read tty output")- }
- if !strings.Contains(string(buf), "Cowardly refusing") {
@erikh
Let's try to use the bytes package wherever possible. Also, buf has 1024 length even if Read did not read 1024 bytes. I suggest the following:n, err := pty.Read(buf)
if err != nil { ... }
if !bytes.Contains(buf[:n], []byte("Cowardly refusing")) { ... }
—
Reply to this email directly or view it on GitHub.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <[email protected]> (github: erikh)
|
ping @tiborvass can you review again I think your comments were fixed :) |
|
LGTM |
docker save: Do not save to a terminal.
Pretty straightforward, something I noticed while triaging an issue.
The "cowardly refusing" is a hat-tip to gzip which says something similar when you try to do this.