invertase / melos

🌋 A tool for managing Dart projects with multiple packages. With IntelliJ and Vscode IDE support. Supports automated versioning, changelogs & publishing via Conventional Commits.
https://melos.invertase.dev/~melos-latest
Apache License 2.0
1.07k stars 193 forks source link

fix: Cannot specify `-d <deviceName>` when `deviceName` includes single quote #700

Open roberthartman opened 2 months ago

roberthartman commented 2 months ago

Is there an existing issue for this?

Version

3.4.0

Description

I am using melos dev -- -d "Robert’s iPhone" to pass the -d option to my dev script, which runs flutter run:

dev:
    run: melos exec -- flutter run --flavor development lib/main_development.dart

This works, as long as the in "Robert’s" is not ' (specifically, note that the former has a bit of forward leans, the latter ' does not. I'll call the former "apostrophe" and the latter "single quote"). If I change my phone's name in iOS to use single quote, and then use a single quote in my arguments to the melos script, the script fails with:

/bin/sh: eval: line 0: unexpected EOF while looking for matching `''
/bin/sh: eval: line 1: syntax error: unexpected end of file

I have tried escaping the single quote, wrapping Robert's iPhone with backticks, and nothing works. However, if I call flutter run directly, the single quote is not a problem: flutter run --flavor development lib/main_development.dart -d "Robert's iPhone"

Steps to reproduce

See description.

Expected behavior

There should be a way to pass arguments containing single quote(s) to a script.

Screenshots

No response

Additional context and comments

No response

spydon commented 2 months ago

Try to escape the single quote: `"Robert\'s iPhone"

roberthartman commented 2 months ago

Try to escpape the single quote: `"Robert's iPhone"

@spydon I did try that.