This commit is contained in:
Brad Rydzewski 2014-11-01 11:28:59 -07:00
parent f3eb93ca18
commit f21fd563e8
3 changed files with 3 additions and 3 deletions

View file

@ -43,7 +43,7 @@ func (b *Buildfile) WriteComment(comment string) {
// are not echoed back to the console, and are // are not echoed back to the console, and are
// kept private by default. // kept private by default.
func (b *Buildfile) WriteEnv(key, value string) { func (b *Buildfile) WriteEnv(key, value string) {
b.WriteString(fmt.Sprintf("export %s=%s\n", key, value)) b.WriteString(fmt.Sprintf("export %s=%q\n", key, value))
} }
// WriteHost adds an entry to the /etc/hosts file. // WriteHost adds an entry to the /etc/hosts file.

View file

@ -35,7 +35,7 @@ func TestWrite(t *testing.T) {
f = &Buildfile{} f = &Buildfile{}
f.WriteEnv("FOO", "BAR") f.WriteEnv("FOO", "BAR")
got, want = f.String(), "export FOO=BAR\n" got, want = f.String(), "export FOO=\"BAR\"\n"
if got != want { if got != want {
t.Errorf("Exepected WriteEnv returned %s, got %s", want, got) t.Errorf("Exepected WriteEnv returned %s, got %s", want, got)
} }

View file

@ -103,7 +103,7 @@ func (b *Build) Write(f *buildfile.Buildfile, r *repo.Repo) {
func (b *Build) WriteBuild(f *buildfile.Buildfile) { func (b *Build) WriteBuild(f *buildfile.Buildfile) {
// append environment variables // append environment variables
for _, env := range b.Env { for _, env := range b.Env {
parts := strings.Split(env, "=") parts := strings.SplitN(env, "=", 2)
if len(parts) != 2 { if len(parts) != 2 {
continue continue
} }