You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-11-23 21:44:44 +02:00
local backend: fix steps having logs form other steps (#5582)
## problem if steps where started concurrent, the stdout pipeline reader war overwritten and you randomly got the wrong command stream from a step. ## change where we have possible race conditions, we now use thread save types e.g. store the command struct and the output reader in sync.Map also a lot of tests where added
This commit is contained in:
@@ -100,11 +100,19 @@ func (e *local) execClone(ctx context.Context, step *types.Step, state *workflow
|
||||
cmd.Env = env
|
||||
cmd.Dir = state.workspaceDir
|
||||
|
||||
// Get output and redirect Stderr to Stdout
|
||||
e.output, _ = cmd.StdoutPipe()
|
||||
cmd.Stderr = cmd.Stdout
|
||||
reader, err := cmd.StdoutPipe()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
state.stepCMDs[step.UUID] = cmd
|
||||
// Save state
|
||||
state.stepState.Store(step.UUID, &stepState{
|
||||
cmd: cmd,
|
||||
output: reader,
|
||||
})
|
||||
|
||||
// Get output and redirect Stderr to Stdout
|
||||
cmd.Stderr = cmd.Stdout
|
||||
|
||||
return cmd.Start()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user