Skip to content

Can't retrieve environment declarations passed as arguments to dart run #61373

@parlough

Description

@parlough

Retrieving environment declarations passed to dart run stopped working (tested on 3.10.0-49.0.dev and 3.10.0-118.0.dev). I'm assuming due to ab44b20 or related preparation work. If I pass them to the base dart CLI they do work, but I would expect them to be accepted as arguments to the run subcommand (which is documented as an option).

With a code snippet, like the following.

const bool shouldSayHello = bool.fromEnvironment('hello');

void main() {
  print(shouldSayHello);
}

Both the following commands print "false", when I would expect them to print "true".

dart run --define=hello=true bin/main.dart
dart run -D=hello=true bin/main.dart

If I pass them to the base dart CLI instead of the subcommand, they do print "true".

dart --define=hello=true run bin/main.dart
dart -D=hello=true run bin/main.dart

\cc @a-siva @bkonyi

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-dart-cliUse area-dart-cli for issues related to the 'dart' command like tool.dart-cli-runIssues related to 'dart run'type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions