diff --git a/shared/build/buildfile/buildfile.go b/shared/build/buildfile/buildfile.go index da56fb6f2..c08463808 100644 --- a/shared/build/buildfile/buildfile.go +++ b/shared/build/buildfile/buildfile.go @@ -43,7 +43,7 @@ func (b *Buildfile) WriteComment(comment string) { // are not echoed back to the console, and are // kept private by default. 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. diff --git a/shared/build/buildfile/buildfile_test.go b/shared/build/buildfile/buildfile_test.go index c4a48c993..f9e0e942f 100644 --- a/shared/build/buildfile/buildfile_test.go +++ b/shared/build/buildfile/buildfile_test.go @@ -35,7 +35,7 @@ func TestWrite(t *testing.T) { f = &Buildfile{} f.WriteEnv("FOO", "BAR") - got, want = f.String(), "export FOO=BAR\n" + got, want = f.String(), "export FOO=\"BAR\"\n" if got != want { t.Errorf("Exepected WriteEnv returned %s, got %s", want, got) } diff --git a/shared/build/script/script.go b/shared/build/script/script.go index 372e1dc20..62fa8e7eb 100644 --- a/shared/build/script/script.go +++ b/shared/build/script/script.go @@ -103,7 +103,7 @@ func (b *Build) Write(f *buildfile.Buildfile, r *repo.Repo) { func (b *Build) WriteBuild(f *buildfile.Buildfile) { // append environment variables for _, env := range b.Env { - parts := strings.Split(env, "=") + parts := strings.SplitN(env, "=", 2) if len(parts) != 2 { continue }