Skip to content

Commit

Permalink
Merge pull request #71 from q-flexai/main
Browse files Browse the repository at this point in the history
llamacc: add option to always fallback to local build on error.
  • Loading branch information
nelhage authored Mar 19, 2024
2 parents 534beb1 + 3a0aee1 commit 5f09953
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 5f09953

Please sign in to comment.