X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/1f92b08e21c19dfa0c6d2260fe2fd8b24529e9e3..87f3da84318306184165dae50f75ac6721d89285:/services/crunch-dispatch-slurm/script.go diff --git a/services/crunch-dispatch-slurm/script.go b/services/crunch-dispatch-slurm/script.go index fb16e593e5..d0bfbc4a92 100644 --- a/services/crunch-dispatch-slurm/script.go +++ b/services/crunch-dispatch-slurm/script.go @@ -8,8 +8,14 @@ import ( "strings" ) -func execScript(args []string) string { - s := "#!/bin/sh\nexec" +func execScript(args []string, env map[string]string) string { + s := "#!/bin/sh\n" + for k, v := range env { + s += k + `='` + s += strings.Replace(v, `'`, `'\''`, -1) + s += `' ` + } + s += `exec` for _, w := range args { s += ` '` s += strings.Replace(w, `'`, `'\''`, -1)