genbindings/clang: bubble error handling for retry

This commit is contained in:
mappu 2024-10-16 18:16:53 +13:00
parent 3a274ec9c5
commit 697e1fc488

View File

@ -39,27 +39,22 @@ func clangExec(ctx context.Context, clangBin, inputHeader string, cflags []strin
var wg sync.WaitGroup var wg sync.WaitGroup
var inner []interface{} var inner []interface{}
var innerErr error
wg.Add(1) wg.Add(1)
go func() { go func() {
defer wg.Done() defer wg.Done()
inner, innerErr = clangStripUpToFile(pr, inputHeader)
inner__, err := clangStripUpToFile(pr, inputHeader)
if err != nil {
panic(err)
}
inner = inner__
}() }()
err = cmd.Wait() err = cmd.Wait()
if err != nil { if err != nil {
panic(err) return nil, fmt.Errorf("Command: %w", err)
} }
wg.Wait() wg.Wait()
return inner, nil return inner, innerErr
} }
func mustClangExec(ctx context.Context, clangBin, inputHeader string, cflags []string) []interface{} { func mustClangExec(ctx context.Context, clangBin, inputHeader string, cflags []string) []interface{} {
@ -71,6 +66,7 @@ func mustClangExec(ctx context.Context, clangBin, inputHeader string, cflags []s
log.Printf("WARNING: Clang execution failed: %v", err) log.Printf("WARNING: Clang execution failed: %v", err)
time.Sleep(ClangRetryDelay) time.Sleep(ClangRetryDelay)
log.Printf("Retrying...") log.Printf("Retrying...")
continue
} }
// Success // Success