Skip to content

Commit

Permalink
fix directive execution engine bug that was creating a file instead o…
Browse files Browse the repository at this point in the history
…f a dir

Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
  • Loading branch information
krancour authored and hiddeco committed Sep 3, 2024
1 parent 72894a0 commit 6c63610
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/directives/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ func NewEngine(
// Execute runs the provided list of directives in sequence.
func (e *Engine) Execute(ctx context.Context, steps []Step) (Result, error) {
// TODO(hidde): allow the workDir to be restored from a previous execution.
workDir, err := os.CreateTemp("", "run-")
workDir, err := os.MkdirTemp("", "run-")
if err != nil {
return ResultFailure, fmt.Errorf("temporary working directory creation failed: %w", err)
}
defer os.RemoveAll(workDir.Name())
defer os.RemoveAll(workDir)

// Initialize the shared state that will be passed to each step.
state := make(State)
Expand All @@ -67,7 +67,7 @@ func (e *Engine) Execute(ctx context.Context, steps []Step) (Result, error) {
}

stepCtx := &StepContext{
WorkDir: workDir.Name(),
WorkDir: workDir,
SharedState: state,
Alias: d.Alias,
Config: d.Config.DeepCopy(),
Expand Down

0 comments on commit 6c63610

Please sign in to comment.