Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
d5671739
Unverified
Commit
d5671739
authored
Apr 02, 2021
by
Dave Shifflett
Committed by
GitHub
Apr 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not run version check if generating shell completion and stdout isn't terminal (#79418)
parent
d44ab58d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
2 deletions
+40
-2
flutter_command_runner.dart
.../flutter_tools/lib/src/runner/flutter_command_runner.dart
+4
-1
flutter_command_runner_test.dart
...est/general.shard/runner/flutter_command_runner_test.dart
+34
-0
utils.dart
packages/flutter_tools/test/general.shard/runner/utils.dart
+2
-1
No files found.
packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
View file @
d5671739
...
...
@@ -253,11 +253,14 @@ class FlutterCommandRunner extends CommandRunner<void> {
globals
.
flutterVersion
.
ensureVersionFile
();
final
bool
machineFlag
=
topLevelResults
[
'machine'
]
as
bool
;
final
bool
ci
=
await
globals
.
botDetector
.
isRunningOnBot
;
final
bool
redirectedCompletion
=
!
globals
.
stdio
.
hasTerminal
&&
(
topLevelResults
.
command
?.
name
??
''
).
endsWith
(
'-completion'
);
final
bool
isMachine
=
machineFlag
||
ci
||
redirectedCompletion
;
final
bool
versionCheckFlag
=
topLevelResults
[
'version-check'
]
as
bool
;
final
bool
explicitVersionCheckPassed
=
topLevelResults
.
wasParsed
(
'version-check'
)
&&
versionCheckFlag
;
if
(
topLevelResults
.
command
?.
name
!=
'upgrade'
&&
(
explicitVersionCheckPassed
||
(
versionCheckFlag
&&
!
ci
&&
!
machineFlag
)))
{
(
explicitVersionCheckPassed
||
(
versionCheckFlag
&&
!
isMachine
)))
{
await
globals
.
flutterVersion
.
checkFlutterVersionFreshness
();
}
...
...
packages/flutter_tools/test/general.shard/runner/flutter_command_runner_test.dart
View file @
d5671739
...
...
@@ -108,6 +108,40 @@ void main() {
BotDetector:
()
=>
const
FakeBotDetector
(
true
),
},
initializeFlutterRoot:
false
);
testUsingContext
(
'checks that Flutter installation is up-to-date if shell completion to terminal'
,
()
async
{
final
FlutterCommand
command
=
DummyFlutterCommand
(
name:
'bash-completion'
);
final
FlutterCommandRunner
runner
=
createTestCommandRunner
(
command
)
as
FlutterCommandRunner
;
final
FakeFlutterVersion
version
=
globals
.
flutterVersion
as
FakeFlutterVersion
;
await
runner
.
run
(<
String
>[
'bash-completion'
]);
expect
(
version
.
didCheckFlutterVersionFreshness
,
true
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Platform:
()
=>
platform
,
FlutterVersion:
()
=>
FakeFlutterVersion
(),
BotDetector:
()
=>
const
FakeBotDetector
(
false
),
Stdio:
()
=>
FakeStdio
(
hasFakeTerminal:
true
),
});
testUsingContext
(
'does not check that Flutter installation is up-to-date if redirecting shell completion'
,
()
async
{
final
FlutterCommand
command
=
DummyFlutterCommand
(
name:
'bash-completion'
);
final
FlutterCommandRunner
runner
=
createTestCommandRunner
(
command
)
as
FlutterCommandRunner
;
final
FakeFlutterVersion
version
=
globals
.
flutterVersion
as
FakeFlutterVersion
;
await
runner
.
run
(<
String
>[
'bash-completion'
]);
expect
(
version
.
didCheckFlutterVersionFreshness
,
false
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Platform:
()
=>
platform
,
FlutterVersion:
()
=>
FakeFlutterVersion
(),
BotDetector:
()
=>
const
FakeBotDetector
(
false
),
Stdio:
()
=>
FakeStdio
(
hasFakeTerminal:
false
),
});
testUsingContext
(
'Fetches tags when --version is used'
,
()
async
{
final
FlutterCommandRunner
runner
=
createTestCommandRunner
(
DummyFlutterCommand
())
as
FlutterCommandRunner
;
final
FakeFlutterVersion
version
=
globals
.
flutterVersion
as
FakeFlutterVersion
;
...
...
packages/flutter_tools/test/general.shard/runner/utils.dart
View file @
d5671739
...
...
@@ -13,6 +13,7 @@ class DummyFlutterCommand extends FlutterCommand {
DummyFlutterCommand
({
this
.
shouldUpdateCache
=
false
,
this
.
noUsagePath
=
false
,
this
.
name
=
'dummy'
,
this
.
commandFunction
,
});
...
...
@@ -29,7 +30,7 @@ class DummyFlutterCommand extends FlutterCommand {
Future
<
String
>
get
usagePath
=>
noUsagePath
?
null
:
super
.
usagePath
;
@override
String
get
name
=>
'dummy'
;
final
String
name
;
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment