X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f6a29cc714dd3409f865ceb799a886dd0b5d8152..25eb38e9a93228f349046d36e23b735c164f5b99:/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)