Skip to content

implicit dart run subcommand eats script parameters when VM flags are passed #43487

@jcollins-g

Description

@jcollins-g

Reproduced on 2.10.0-145.0.dev and 2.10.0-110.0.dev, Linux and Mac.

Trying to pass a flag to the VM while executing a script doesn't work, explicitly or otherwise, if a parameter is passed that dart run happens to recognize.

For example:

~/dart/dartdoc
$ dart --version
Dart SDK version: 2.10.0-145.0.dev (dev) (Fri Sep 18 10:38:14 2020 -0700) on "linux_x64"
~/dart/dartdoc
$ dart --enable-vm-service:0 bin/dartdoc.dart --help
Run a Dart program.

Usage: dart run [arguments] <dart file | package target>
-h, --help                                             Print this usage information.

Debugging options:
    --observe=<[<port>[/<bind-address>]]>              The observe flag is a convenience flag used to run a program with a set of common options useful for debugging.

Options implied by --observe are currently:
    --enable-vm-service=<[<port>[/<bind-address>]]>    Enables the VM service and listens on the specified port for connections (default port number is 8181, default bind address is localhost).
    --[no-]pause-isolates-on-exit                      Pause isolates on exit when running with --enable-vm-service.
    --[no-]pause-isolates-on-unhandled-exceptions      Pause isolates when an unhandled exception is encountered when running with --enable-vm-service.
    --[no-]warn-on-pause-with-no-debugger              Print a warning when an isolate pauses with no attached debugger when running with --enable-vm-service.

Other debugging options:
    --[no-]pause-isolates-on-start                     Pause isolates on start when running with --enable-vm-service.
    --[no-]enable-asserts                              Enable assert statements.

Run "dart help" to see global options.
~/dart/dartdoc
$

Expected behavior is that I would see dartdoc's --help output rather than dart runs. This breaks cases where parameters need to be passed to the VM and the application simultaneously, such as when doing coverage runs in a CI (the case where I first saw this). This works as expected in Dart 2.9.3.

Metadata

Metadata

Assignees

Labels

area-dart-cliUse area-dart-cli for issues related to the 'dart' command like tool.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions