-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On powershell pub add
given examples fails when yaml contain double quotes
#4470
Comments
Investigated and it seems the issue was caused by the However we can remove the leading and the trailing single quote to solve the first phase of the issue. |
Ah - I thought it was our parsing that was broken! Thanks for investigating. Surely we should fix the help message. |
What I was experimenting is update the match from our end to give a lenient input. Something like replace |
Hmm could you try again with the single quotes. I cannot reproduce your error:
Seems to parse alright... |
Ahh - I think the problem might be that you are on windows - what shell are you using? |
Yeah I'm using the PoweShell on Windows 11. |
Here are rules for cmd https://stackoverflow.com/questions/7760545/escape-double-quotes-in-parameter Are you running dart from a flutter install? I think that goes through a batch file... |
Initially yes. Running |
How about |
The issue command was tested through this as I exported the Dart SDK path from the Flutter install. > which dart
/x/SDK/flutter/bin/dart |
I'm just trying to find out where in the pipeline the quotation gets broken.
It seems like powershell always needs a back-tick ` before each " character or https://stackoverflow.com/a/44843143/4809566 Maybe we just update the examples to include the space, and things "work" on powershell (cmd is still an issue though) |
@jonasfj maybe passing yaml/json on the commandline was a mistake. Seems like there is no good way to pass quotes across powershell, cmd and bash... |
{$source:$dest}
when there is no space between :
and $dest
pub add
given examples fails when yaml contain double quotes
And |
For |
The point is, that dart should receive the string In cmd you can tripple the quotes None of those are desirable. Now, because we are parsing yaml and not json, we can drop the quotes, but insert a space:
That should work on cmd, powershell and bash (as long as the path-name doesn't contain really weird characters)
We don't want to patch the string up after the fact to somehow become valid yaml. It is not a general solution. |
Environment
dart --version
): Dart SDK version: 3.6.0 (stable) (Thu Dec 5 07:46:24 2024 -0800) on "windows_x64"Problem
As the help message of
pub add
tells:But when I run
dart pub add 'foundation:{"path":"../foundation"}'
it tells:The only allowed prefixes are "dev:" and "override:"
And without the single quotes:
Because app depends on foundation from unknown source "path:../foundation", version solving failed.
Changing to
dart pub add foundation:{"path": "../foundation"}
(without the single quotes and extra space between:
and"..
) will solve the issue.Expected behavior
The command should execute without exceptions.
Actual behavior
The command will fail to execute.
Logs
The text was updated successfully, but these errors were encountered: