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 <[email protected]>
  • Loading branch information
krancour committed Aug 29, 2024
1 parent e3c3941 commit 6b3c03f
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 @@ -32,11 +32,11 @@ func NewEngine(registry DirectiveRegistry) *Engine {
// 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 @@ -52,7 +52,7 @@ func (e *Engine) Execute(ctx context.Context, steps []Step) (Result, error) {
}

if result, err := step.Run(ctx, &StepContext{
WorkDir: workDir.Name(),
WorkDir: workDir,
SharedState: state,
Alias: d.Alias,
Config: d.Config.DeepCopy(),
Expand Down

0 comments on commit 6b3c03f

Please sign in to comment.