Skip to content

Commit

Permalink
fix host worker run when step name contains spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
zc2638 committed Mar 11, 2024
1 parent e90c41e commit b497b53
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/worker/hooks/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"os"
"os/exec"
"path/filepath"
"strings"

"github.com/zc2638/wslog"

Expand Down Expand Up @@ -49,7 +50,8 @@ func (h *host) Begin(ctx context.Context, spec *worker.Workflow) error {
args = step.Shell[1:]
}
cmdData := shell.Script(step.Command)
fp := filepath.Join(scriptPath, step.Name+shell.Suffix)
stepName := strings.ReplaceAll(step.Name, " ", "_")
fp := filepath.Join(scriptPath, stepName+shell.Suffix)
if err := os.WriteFile(fp, []byte(cmdData), os.ModePerm); err != nil {
log.Error("cannot write file", "error", err)
return err
Expand Down

0 comments on commit b497b53

Please sign in to comment.