Skip to content

[flutter_tools] ProcessException trying to call git #133585

Closed

Description

@christopherfujino

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)

Activity

  1. added
    P1High-priority issues at the top of the work list
    team-toolOwned by Flutter Tool team
    triaged-toolTriaged by Flutter Tool team
    on Aug 29, 2023
  2. andrewkolos commented on Feb 13, 2024

    @andrewkolos
    Contributor

    Discussed with @christopherfujino. I see two ways to resolve this issue:

    1. Early on in the tools execution, make a call to canRun to make sure git is 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).
    2. Make sure all invocations of git (at least those in version.dart) are routed through some abstraction (a simple function will do) that catches ProcessExceptions 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.

  3. added
    P2Important issues not at the top of the work list
    c: crashStack traces logged to the console
    and removed
    P1High-priority issues at the top of the work list
    on Feb 13, 2024
  4. andrewkolos commented on Feb 14, 2024

    @andrewkolos
    Contributor

    Another option is to catch this exception at-or-near the top level of the tool code (such as in handleToolError). We could catch ProcessException, 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.

  5. andrewkolos commented on Feb 14, 2024

    @andrewkolos
    Contributor

    Putting this off because I don't see a clear best solution.

  6. removed their assignment
    on Feb 14, 2024
  7. andrewkolos commented on Aug 28, 2024

    @andrewkolos
    Contributor

    Another option is to catch this exception at-or-near the top level of the tool code (such as in handleToolError). We could catch ProcessException, grep its message string, and (if there's a match) exit without generating a crash report.

    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 ProcessException and 'git' might be sufficient.

  8. github-actions commented on Sep 23, 2024

    @github-actions

    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 -v and a minimal reproduction of the issue.

  9. locked as resolved and limited conversation to collaborators on Sep 23, 2024
  10. reopened this on Dec 2, 2024
  11. bkonyi commented on Dec 2, 2024

    @bkonyi
    Contributor

    This still seems to be an issue.

  12. bkonyi commented on Dec 2, 2024

    @bkonyi
    Contributor

    I looked through the crash samples and they're all from Windows users.

  13. andrewkolos commented on Dec 2, 2024

    @andrewkolos
    Contributor

    This still seems to be an issue.

    #154445 won't be in user hands until 3.27. Are you still seeing this in beta?

  14. bkonyi commented on Dec 2, 2024

    @bkonyi
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: crashStack traces logged to the consoleplatform-windowsBuilding on or for Windows specificallyteam-toolOwned by Flutter Tool teamtriaged-toolTriaged by Flutter Tool team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions