Skip to content

Commit 7746156

Browse files
committed
fix bug
1 parent ea33af4 commit 7746156

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

internal/cmd/exec_spec.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/dagu-org/dagu/internal/core"
1212
"github.com/dagu-org/dagu/internal/core/spec"
1313
"github.com/goccy/go-yaml"
14+
"github.com/kballard/go-shellquote"
1415
)
1516

1617
// ExecOptions captures the inline configuration for building an ad-hoc DAG.
@@ -36,9 +37,9 @@ type execSpec struct {
3637
}
3738

3839
type execStep struct {
39-
Name string `yaml:"name"`
40-
Command []string `yaml:"command,omitempty"`
41-
Shell string `yaml:"shell,omitempty"`
40+
Name string `yaml:"name"`
41+
Command string `yaml:"command,omitempty"`
42+
Shell string `yaml:"shell,omitempty"`
4243
}
4344

4445
func buildExecDAG(ctx *Context, opts ExecOptions) (*core.DAG, string, error) {
@@ -54,6 +55,10 @@ func buildExecDAG(ctx *Context, opts ExecOptions) (*core.DAG, string, error) {
5455
return nil, "", fmt.Errorf("invalid DAG name: %w", err)
5556
}
5657

58+
// Join command args into a single properly quoted string
59+
// This ensures the command is treated as a single command, not multiple commands
60+
commandStr := shellquote.Join(opts.CommandArgs...)
61+
5762
specDoc := execSpec{
5863
Name: name,
5964
Type: core.TypeChain,
@@ -64,7 +69,7 @@ func buildExecDAG(ctx *Context, opts ExecOptions) (*core.DAG, string, error) {
6469
Steps: []execStep{
6570
{
6671
Name: defaultStepName,
67-
Command: opts.CommandArgs,
72+
Command: commandStr,
6873
Shell: opts.ShellOverride,
6974
},
7075
},

internal/core/spec/step.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,7 @@ var singleCommandOnlyExecutors = map[string]bool{
689689
"archive": true,
690690
"github_action": true,
691691
"github-action": true,
692+
"gha": true,
692693
"mail": true,
693694
"dag": true,
694695
"parallel": true,

0 commit comments

Comments
 (0)