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 inner []interface{}
var innerErr error
wg.Add(1)
go func() {
defer wg.Done()
inner__, err := clangStripUpToFile(pr, inputHeader)
if err != nil {
panic(err)
}
inner = inner__
inner, innerErr = clangStripUpToFile(pr, inputHeader)
}()
err = cmd.Wait()
if err != nil {
panic(err)
return nil, fmt.Errorf("Command: %w", err)
}
wg.Wait()
return inner, nil
return inner, innerErr
}
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)
time.Sleep(ClangRetryDelay)
log.Printf("Retrying...")
continue
}
// Success