Skip to content

Commit

Permalink
llamacc: add option to always fallback to local build on error.
Browse files Browse the repository at this point in the history
Workaround for nelhage#69

Signed-off-by: Quentin Casasnovas <[email protected]>
  • Loading branch information
q-flexai committed Feb 29, 2024
1 parent 534beb1 commit 3a0aee1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cmd/llamacc/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type Config struct {
FullPreprocess bool
Function string
LocalPreprocess bool
LocalFallback bool
BuildID string

// FilteredWarnings is a list of warnings that we should always filter
Expand Down Expand Up @@ -102,6 +103,8 @@ func ParseConfig(env []string) Config {
out.LocalCC = val
case "LOCAL_CXX":
out.LocalCXX = val
case "LOCAL_FALLBACK":
out.LocalFallback = BoolConfigTrue(val)
case "FILTER_WARNINGS":
out.FilteredWarnings = StringArrayConfig(val)
default:
Expand Down
4 changes: 3 additions & 1 deletion cmd/llamacc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,9 @@ func main() {
if ex, ok := err.(*exec.ExitError); ok {
os.Exit(ex.ExitCode())
}
if strings.Contains(err.Error(), "timed out") {
if cfg.LocalFallback {
goto RetryLocal
} else if strings.Contains(err.Error(), "timed out") {
goto RetryLocal
} else {
fmt.Fprintf(os.Stderr, "Running llamacc: %s\n", err.Error())
Expand Down

0 comments on commit 3a0aee1

Please sign in to comment.