Skip to content

Commit

Permalink
feat: command add origin execution log path environment
Browse files Browse the repository at this point in the history
  • Loading branch information
halalala222 committed Aug 16, 2024
1 parent 11a0808 commit 61e3c13
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/dag/executor/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import (
"sync"
"syscall"

"github.com/daguflow/dagu/internal/util"

"github.com/daguflow/dagu/internal/constants"
"github.com/daguflow/dagu/internal/dag"
"github.com/daguflow/dagu/internal/util"
)

type commandExecutor struct {
Expand All @@ -40,9 +40,11 @@ func newCommand(ctx context.Context, step dag.Step) (Executor, error) {
if len(step.Dir) > 0 && !util.FileExists(step.Dir) {
return nil, fmt.Errorf("directory %q does not exist", step.Dir)
}
stepSpecialExecutionLogPathKey := util.GenerateStepSpecialExecutionLogPathKey(step.NodeID)
cmd.Dir = step.Dir
cmd.Env = append(cmd.Env, os.Environ()...)
cmd.Env = append(cmd.Env, step.Variables...)
cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", constants.StepDaguExecutionLogPathKeySuffix, os.Getenv(stepSpecialExecutionLogPathKey)))
step.OutputVariables.Range(func(_, value any) bool {
cmd.Env = append(cmd.Env, value.(string))
return true
Expand Down

0 comments on commit 61e3c13

Please sign in to comment.