Skip to content

fix: add timeout to prevent bootstrapping from hanging indefinitely#1548

Merged
marcossevilla merged 4 commits into
mainfrom
claude/fix-issue-1547-mhbK1
Mar 26, 2026
Merged

fix: add timeout to prevent bootstrapping from hanging indefinitely#1548
marcossevilla merged 4 commits into
mainfrom
claude/fix-issue-1547-mhbK1

Conversation

@Statyk7

@Statyk7 Statyk7 commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a 120-second timeout to the Mason hook's preGen call during bootstrapping, which internally runs dart pub get for hook dependencies
  • Adds a 120-second timeout to _Cmd.run() (used by Dart.pubGet() and Flutter.pubGet()) so post-generation package installs also have a timeout
  • On timeout, the CLI now surfaces a clear error message instead of hanging indefinitely

Closes #1547

Context

When connected to a Wi-Fi network without internet access (e.g. phone hotspot with mobile data off), the bootstrapping step hangs indefinitely because the underlying dart pub get process never receives a socket error — it just waits forever. With no network at all, a socket error surfaces after ~35s, which is fine.

This PR adds timeouts at two points that can hang:

  1. generator.hooks.preGen() in CreateSubCommand.runCreate — wrapped with .timeout(), catches TimeoutException, fails the progress indicator, logs a clear error, and returns ExitCode.unavailable
  2. _Cmd.run() — accepts an optional Duration? timeout parameter; Dart.pubGet() and Flutter.pubGet() pass a 120s timeout so the process throws a ProcessException on timeout

Test plan

  • Verify new test returns unavailable exit code when preGen times out passes in create_subcommand_test.dart
  • Verify new test throws ProcessException when pub get times out passes in dart_cli_test.dart
  • Verify new test throws ProcessException when pub get times out passes in flutter_cli_test.dart
  • Verify all existing tests still pass
  • Manual: connect to Wi-Fi with no internet, run very_good create flutter_app testapp — should fail with a timeout error after 120s instead of hanging indefinitely

https://claude.ai/code/session_01JoFEgFpRkH5idHrQFNy6xP

…angs

When connected to a network without internet access, the bootstrapping
step (Mason hook's internal dart pub get) and subsequent pub get commands
can hang indefinitely. This adds a 120-second timeout that surfaces a
clear error message instead.

Closes #1547

https://claude.ai/code/session_01JoFEgFpRkH5idHrQFNy6xP
@Statyk7 Statyk7 requested a review from a team as a code owner March 25, 2026 20:44
@marcossevilla

Copy link
Copy Markdown
Member

lgtm but seems there's a few lint warnings, I can approve once CI passes @Statyk7

@marcossevilla marcossevilla merged commit f808c53 into main Mar 26, 2026
22 checks passed
@marcossevilla marcossevilla deleted the claude/fix-issue-1547-mhbK1 branch March 26, 2026 15:02
@vgvbot vgvbot mentioned this pull request Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bootstrapping hangs indefinitely when connected to network without internet access

3 participants