Thanks to visit codestin.com
Credit goes to github.com

Skip to content

docker save: Do not save to a terminal.#8321

Merged
tiborvass merged 1 commit into
moby:masterfrom
erikh:ui_save_output
Oct 24, 2014
Merged

docker save: Do not save to a terminal.#8321
tiborvass merged 1 commit into
moby:masterfrom
erikh:ui_save_output

Conversation

@erikh

@erikh erikh commented Sep 30, 2014

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this be it's own test or no? just wondering

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh nm then we would have to make the repo again

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jessfraz

jessfraz commented Oct 1, 2014

Copy link
Copy Markdown
Contributor

LGTM

@vieux

vieux commented Oct 1, 2014

Copy link
Copy Markdown
Contributor

I guess you can do the same on export ?

@erikh

erikh commented Oct 1, 2014

Copy link
Copy Markdown
Contributor Author

Yep!

On Sep 30, 2014, at 6:32 PM, Victor Vieux [email protected] wrote:

I guess you can do the same on export ?


Reply to this email directly or view it on GitHub.

@jessfraz

jessfraz commented Oct 3, 2014

Copy link
Copy Markdown
Contributor

are we waiting on export or should there be a new PR for that?

@erikh

erikh commented Oct 5, 2014

Copy link
Copy Markdown
Contributor Author

Let's make a new PR for it. I'll put it on my task list.

@vbatts

vbatts commented Oct 6, 2014

Copy link
Copy Markdown
Contributor

LGTM

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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")) { ... }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
@jessfraz

Copy link
Copy Markdown
Contributor

ping @tiborvass can you review again I think your comments were fixed :)

@tiborvass

Copy link
Copy Markdown
Contributor

LGTM

tiborvass added a commit that referenced this pull request Oct 24, 2014
docker save: Do not save to a terminal.
@tiborvass tiborvass merged commit 350e1b7 into moby:master Oct 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants