fix: add timeout to prevent bootstrapping from hanging indefinitely#1548
Merged
Conversation
…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
Member
|
lgtm but seems there's a few lint warnings, I can approve once CI passes @Statyk7 |
marcossevilla
approved these changes
Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
preGencall during bootstrapping, which internally runsdart pub getfor hook dependencies_Cmd.run()(used byDart.pubGet()andFlutter.pubGet()) so post-generation package installs also have a timeoutCloses #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 getprocess 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:
generator.hooks.preGen()inCreateSubCommand.runCreate— wrapped with.timeout(), catchesTimeoutException, fails the progress indicator, logs a clear error, and returnsExitCode.unavailable_Cmd.run()— accepts an optionalDuration? timeoutparameter;Dart.pubGet()andFlutter.pubGet()pass a 120s timeout so the process throws aProcessExceptionon timeoutTest plan
returns unavailable exit code when preGen times outpasses increate_subcommand_test.dartthrows ProcessException when pub get times outpasses indart_cli_test.dartthrows ProcessException when pub get times outpasses influtter_cli_test.dartvery_good create flutter_app testapp— should fail with a timeout error after 120s instead of hanging indefinitelyhttps://claude.ai/code/session_01JoFEgFpRkH5idHrQFNy6xP