Skip to content

Commit

Permalink
fix: give more time for first execution of the binary
Browse files Browse the repository at this point in the history
  • Loading branch information
j178 committed Jan 24, 2024
1 parent 19c0f73 commit c0bcb07
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lang/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,13 @@ func runTest(q *leetcode.QuestionData, genResult *GenerateResult, args []string,
return
}
ran++
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
timeout := 3 * time.Second
if ran == 1 {
// Give more time for the first run.
// On macOS, first time execution of a binary may be slow due to the system's security check.
timeout += 3 * time.Second
}
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()

outputBuf := new(strings.Builder)
Expand Down

0 comments on commit c0bcb07

Please sign in to comment.