mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 14:39:38 +00:00
[ DartDev ] Fixed issue where flags passed after the script name when
using 'dart run' would be interpreted by the 'dart run' argument parser Fixes https://github.com/dart-lang/sdk/issues/42941 Change-Id: I46d7654d62b4575f0684f7faae51d972ac5f7f8c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157542 Reviewed-by: Siva Annamalai <asiva@google.com> Commit-Queue: Ben Konyi <bkonyi@google.com>
This commit is contained in:
parent
c59246d8ad
commit
507ffcfdaf
|
@ -26,7 +26,10 @@ class RunCommand extends DartdevCommand<int> {
|
|||
// provided before any command and to provide a more consistent help message
|
||||
// with the rest of the tool.
|
||||
@override
|
||||
final ArgParser argParser = ArgParser();
|
||||
final ArgParser argParser = ArgParser(
|
||||
// Don't parse flags after script name.
|
||||
allowTrailingOptions: false,
|
||||
);
|
||||
|
||||
@override
|
||||
final bool verbose;
|
||||
|
|
|
@ -108,12 +108,12 @@ void run() {
|
|||
final result = p.runSync('run', [
|
||||
'--enable-experiment=non-nullable',
|
||||
name,
|
||||
'argument1',
|
||||
'--argument1',
|
||||
'argument2',
|
||||
]);
|
||||
|
||||
// --enable-experiment and main.dart should not be passed.
|
||||
expect(result.stdout, equals('[argument1, argument2]\n'));
|
||||
expect(result.stdout, equals('[--argument1, argument2]\n'));
|
||||
expect(result.stderr, isEmpty);
|
||||
expect(result.exitCode, 0);
|
||||
});
|
||||
|
@ -126,12 +126,12 @@ void run() {
|
|||
final result = p.runSync('run', [
|
||||
'--enable-experiment=non-nullable',
|
||||
Uri.file(name).toString(),
|
||||
'argument1',
|
||||
'--argument1',
|
||||
'argument2',
|
||||
]);
|
||||
|
||||
// --enable-experiment and main.dart should not be passed.
|
||||
expect(result.stdout, equals('[argument1, argument2]\n'));
|
||||
expect(result.stdout, equals('[--argument1, argument2]\n'));
|
||||
expect(result.stderr, isEmpty);
|
||||
expect(result.exitCode, 0);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue