You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running "flutter create daemon" (creating an app in a directory "daemon") shows no output.
This is because we blindly look for any argument "daemon" to decide how to set up the logger in executable.dart, not just the one that "args" will treat as the "daemon" command.
A similar problem occurs with several of the other flags we try to set in main(), like runMachine, prefixedErrors, and powershellHelpIndex. I think doctor, help, and muteCommandLogging as written are actually safe, though the comments could definitely better highlight the risk of relying on these in future code.
I think I could make the daemon case more specific.
In general though, this part of the code is definitely fragile. There is a sort of interconnectedness between all of the Command classes, their injected dependencies, and their supported arguments themselves. I've been trying to untangle them gradually, but I clearly missed some cases here.
It would be nice if I could supply a limited arg parser for just pulling off the high level options (daemon, machine, help) that could ignore the rest.
Oh, good idea. We should be able to do that pretty easily. The ArgParser could be just given "daemon", "run", and "attach" as basic commands, and "--help", "--verbose", "--machine", etc, as arguments, and we could use that to determine the basic settings, and then we would just parse everything again once we'd built the actual commands.
I think I looked into this last year, but I found that you can either make an arg parser that is strict or one that is lenient but doesn't give you structured results.
The other option might be to have a trivial parser of our own. That should be relatively easy too. We just need to collect arguments that have "--"/"-" at the start until the first one that doesn't, if I'm understanding what we're looking at here. Maybe those with "--"/"-", then one that's just text, then those with "--"/"-", then ignore everything after the second one that doesn't start with those. That kind of thing. That would avoid the current bugs without much additional complexity.
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.
Activity
jonahwilliams commentedon Feb 11, 2021
I think I could make the daemon case more specific.
In general though, this part of the code is definitely fragile. There is a sort of interconnectedness between all of the Command classes, their injected dependencies, and their supported arguments themselves. I've been trying to untangle them gradually, but I clearly missed some cases here.
It would be nice if I could supply a limited arg parser for just pulling off the high level options (daemon, machine, help) that could ignore the rest.
Hixie commentedon Feb 11, 2021
Oh, good idea. We should be able to do that pretty easily. The ArgParser could be just given "daemon", "run", and "attach" as basic commands, and "--help", "--verbose", "--machine", etc, as arguments, and we could use that to determine the basic settings, and then we would just parse everything again once we'd built the actual commands.
jonahwilliams commentedon Feb 11, 2021
I think I looked into this last year, but I found that you can either make an arg parser that is strict or one that is lenient but doesn't give you structured results.
Hixie commentedon Feb 12, 2021
The other option might be to have a trivial parser of our own. That should be relatively easy too. We just need to collect arguments that have "--"/"-" at the start until the first one that doesn't, if I'm understanding what we're looking at here. Maybe those with "--"/"-", then one that's just text, then those with "--"/"-", then ignore everything after the second one that doesn't start with those. That kind of thing. That would avoid the current bugs without much additional complexity.
[flutter_tools] Do not treat 'daemon' argument as daemon command in l…
github-actions commentedon Sep 7, 2026
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.