genbindings: fix race condition in clang output pipe

This commit is contained in:
Jacek Sieka 2025-01-04 10:39:18 +13:00 committed by mappu
parent 16bb62a11d
commit 60cb03785f

View File

@ -67,13 +67,15 @@ func clangExec(ctx context.Context, clangBin, inputHeader string, cflags []strin
inner, innerErr = clangStripUpToFile(pr, matcher)
}()
// Go documentation says: only call cmd.Wait once all reads from the
// StdoutPipe have completed
wg.Wait()
err = cmd.Wait()
if err != nil {
return nil, fmt.Errorf("Command: %w", err)
}
wg.Wait()
return inner, innerErr
}