X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/483ca35ac4348924cfbc187dab4f1b88a272eea7..8be5c463e63b043a424f56d4f3904c71e4f0a516:/services/crunch-dispatch-slurm/script.go diff --git a/services/crunch-dispatch-slurm/script.go b/services/crunch-dispatch-slurm/script.go index 93ae6b5eb3..d0bfbc4a92 100644 --- a/services/crunch-dispatch-slurm/script.go +++ b/services/crunch-dispatch-slurm/script.go @@ -1,11 +1,21 @@ -package main +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + +package dispatchslurm 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)