1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #10143 from cpuguy83/10129_marshal-indent_dockercfg

Make .dockercfg with json.MarshallIndent
This commit is contained in:
Jessie Frazelle 2015-01-17 14:18:45 -08:00
commit 467b7c8213
2 changed files with 3 additions and 13 deletions

View file

@ -2,7 +2,6 @@ package main
import (
"bytes"
"io"
"os/exec"
"testing"
)
@ -10,17 +9,8 @@ import (
func TestLoginWithoutTTY(t *testing.T) {
cmd := exec.Command(dockerBinary, "login")
// create a buffer with text then a new line as a return
buf := bytes.NewBuffer([]byte("buffer test string \n"))
// use a pipe for stdin and manually copy the data so that
// the process does not get the TTY
in, err := cmd.StdinPipe()
if err != nil {
t.Fatal(err)
}
// copy the bytes into the commands stdin along with a new line
go io.Copy(in, buf)
// Send to stdin so the process does not get the TTY
cmd.Stdin = bytes.NewBufferString("buffer test string \n")
// run the command and block until it's done
if err := cmd.Run(); err == nil {

View file

@ -133,7 +133,7 @@ func SaveConfig(configFile *ConfigFile) error {
configs[k] = authCopy
}
b, err := json.Marshal(configs)
b, err := json.MarshalIndent(configs, "", "\t")
if err != nil {
return err
}