Skip to content

Commit

Permalink
wrapping variables in quotes for bash export (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshfinnie authored and cmac1000 committed Sep 24, 2019
1 parent ee876d3 commit 91313a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/gorson/bash/bash.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func ParamsToShell(parameters map[string]string) string {
for _, key := range keys {
// TODO do we need to do extra escaping here?
v := parameters[key]
lines = append(lines, "export "+key+"="+v)
lines = append(lines, "export "+key+"=\""+v+"\"")
}
return strings.Join(lines, "\n")
}
6 changes: 3 additions & 3 deletions internal/gorson/bash/bash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ var testpairs = []testpair{
"beta": "the_beta_value",
"delta": "the_delta_value",
},
expected: `export alpha=the_alpha_value
export beta=the_beta_value
export delta=the_delta_value`,
expected: `export alpha="the_alpha_value"
export beta="the_beta_value"
export delta="the_delta_value"`,
},
}

Expand Down

0 comments on commit 91313a3

Please sign in to comment.