Skip to content

[dartdev] dart run ignores -D due to kernel cachingΒ #53655

@dcharkes

Description

@dcharkes

Consider:

# bin/my_app.dart

void main() {
  const foo = const String.fromEnvironment('foo', defaultValue: 'no foo');
  print(foo);
}

Passing a full script path works as expected

$ dart -Dfoo=foo run bin/my_app.dart 
foo
$ dart -Dfoo=bar run bin/my_app.dart 
bar
$ dart run -Dfoo=foo bin/my_app.dart 
foo
$ dart run -Dfoo=bar bin/my_app.dart 
bar

However, using just the name instead of the full path uses caching, and ignores the defines:

$ dart -Dfoo=foo run my_app
foo
$ dart -Dfoo=bar run my_app
foo

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

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions