[flutter_tools] ProcessException trying to call git #133585
Copy link
Copy link
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: crashStack traces logged to the consoleStack traces logged to the consoleplatform-windowsBuilding on or for Windows specificallyBuilding on or for Windows specificallyteam-toolOwned by Flutter Tool teamOwned by Flutter Tool teamtriaged-toolTriaged by Flutter Tool teamTriaged by Flutter Tool team
Description
On stable/3.13.1
ProcessPackageException: ProcessException: Failed to find "git" in the search path. Command: git
at LocalProcessManager.runSync(local_process_manager.dart:118)
at ErrorHandlingProcessManager.runSync.<anonymous closure>(error_handling_io.dart:714)
at _runSync(error_handling_io.dart:590)
at ErrorHandlingProcessManager.runSync(error_handling_io.dart:713)
at _runSync(version.dart:835)
at _gitCommitDate(version.dart:434)
at FlutterVersion.checkFlutterVersionFreshness(version.dart:279)
at FlutterCommandRunner.runCommand.<anonymous closure>(flutter_command_runner.dart:311)
at <asynchronous gap>(async)
at AppContext.run.<anonymous closure>(context.dart:150)
at <asynchronous gap>(async)
at FlutterCommandRunner.runCommand(flutter_command_runner.dart:285)
at <asynchronous gap>(async)
at run.<anonymous closure>.<anonymous closure>(runner.dart:115)
at <asynchronous gap>(async)
at AppContext.run.<anonymous closure>(context.dart:150)
at <asynchronous gap>(async)
at main(executable.dart:90)
at <asynchronous gap>(async)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: crashStack traces logged to the consoleStack traces logged to the consoleplatform-windowsBuilding on or for Windows specificallyBuilding on or for Windows specificallyteam-toolOwned by Flutter Tool teamOwned by Flutter Tool teamtriaged-toolTriaged by Flutter Tool teamTriaged by Flutter Tool team
Activity
andrewkolos commentedon Feb 13, 2024
Discussed with @christopherfujino. I see two ways to resolve this issue:
canRunto make suregitis available. If it isn't, tool exit with a useful message. The downside is that this has a non-zero performance penalty. On my windows desktop machine at home, a trivial benchmark estimates that this will take 3-4ms (compiled exe).git(at least those in version.dart) are routed through some abstraction (a simple function will do) that catchesProcessExceptions and tool exits with a friendly message. This avoids the performance penalty, but adds another layer of indirection to any code path that depends on git.Regardless of all this, this isn't a top crasher; and the existing error message (as noisy as it may be) should be sufficient for most users to realize that they need
git. I'm lowering the priority to P2.andrewkolos commentedon Feb 14, 2024
Another option is to catch this exception at-or-near the top level of the tool code (such as in
handleToolError). We could catchProcessException, grep its message string, and (if there's a match) exit without generating a crash report.edit: I think the message string might come from the host OS, not the sdk; so depending on that might not be a good idea.
andrewkolos commentedon Feb 14, 2024
Putting this off because I don't see a clear best solution.
andrewkolos commentedon Aug 28, 2024
I think this is a good approach, but the problem relying on the error messages from the OS is that they are localized, so the messages might differ between languages. However, matching on
ProcessExceptionand'git'might be sufficient.Handle `ProcessException`s due to `git` missing on the host (#154445)
github-actions commentedon Sep 23, 2024
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.bkonyi commentedon Dec 2, 2024
This still seems to be an issue.
bkonyi commentedon Dec 2, 2024
I looked through the crash samples and they're all from Windows users.
andrewkolos commentedon Dec 2, 2024
#154445 won't be in user hands until 3.27. Are you still seeing this in beta?
bkonyi commentedon Dec 2, 2024
Ugh, I was looking at the wrong page of crash reports 🤦♂️ there's nothing on the beta channel that I can see. Sorry about that.