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
712752d2
Unverified
Commit
712752d2
authored
Jun 06, 2022
by
Christopher Fujino
Committed by
GitHub
Jun 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] return terminal to echo and line mode before exiting resident_runner (#105283)
parent
c181e450
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
4 deletions
+52
-4
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+4
-0
run_test.dart
.../flutter_tools/test/commands.shard/hermetic/run_test.dart
+48
-4
No files found.
packages/flutter_tools/lib/src/commands/run.dart
View file @
712752d2
...
...
@@ -716,6 +716,10 @@ class RunCommand extends RunCommandBase {
throwToolExit
(
'Lost connection to device.'
);
}
rethrow
;
}
finally
{
// However we exited from the runner, ensure the terminal has line mode
// and echo mode enabled before we return the user to the shell.
globals
.
terminal
.
singleCharMode
=
false
;
}
return
FlutterCommandResult
(
ExitStatus
.
success
,
...
...
packages/flutter_tools/test/commands.shard/hermetic/run_test.dart
View file @
712752d2
...
...
@@ -23,6 +23,7 @@ import 'package:flutter_tools/src/base/file_system.dart';
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/base/terminal.dart'
;
import
'package:flutter_tools/src/base/user_messages.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
...
...
@@ -47,14 +48,14 @@ import '../../src/fakes.dart';
import
'../../src/test_flutter_command_runner.dart'
;
void
main
(
)
{
setUpAll
(()
{
Cache
.
disableLocking
();
});
group
(
'run'
,
()
{
FakeDeviceManager
mockDeviceManager
;
FileSystem
fileSystem
;
setUpAll
(()
{
Cache
.
disableLocking
();
});
setUp
(()
{
mockDeviceManager
=
FakeDeviceManager
();
fileSystem
=
MemoryFileSystem
.
test
();
...
...
@@ -657,6 +658,35 @@ void main() {
});
});
group
(
'terminal'
,
()
{
FakeAnsiTerminal
fakeTerminal
;
setUp
(()
{
fakeTerminal
=
FakeAnsiTerminal
();
});
testUsingContext
(
'Flutter run sets terminal singleCharMode to false on exit'
,
()
async
{
final
FakeResidentRunner
residentRunner
=
FakeResidentRunner
();
final
TestRunCommandWithFakeResidentRunner
command
=
TestRunCommandWithFakeResidentRunner
();
command
.
fakeResidentRunner
=
residentRunner
;
await
createTestCommandRunner
(
command
).
run
(<
String
>[
'run'
,
'--no-pub'
,
]);
// The sync completer where we initially set `terminal.singleCharMode` to
// `true` does not execute in unit tests, so explicitly check the
// `setSingleCharModeHistory` that the finally block ran, setting this
// back to `false`.
expect
(
fakeTerminal
.
setSingleCharModeHistory
,
contains
(
false
));
},
overrides:
<
Type
,
Generator
>{
AnsiTerminal:
()
=>
fakeTerminal
,
Cache:
()
=>
Cache
.
test
(
processManager:
FakeProcessManager
.
any
()),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
testUsingContext
(
'Flutter run catches service has disappear errors and throws a tool exit'
,
()
async
{
final
FakeResidentRunner
residentRunner
=
FakeResidentRunner
();
residentRunner
.
rpcError
=
RPCError
(
'flutter._listViews'
,
RPCErrorCodes
.
kServiceDisappeared
,
''
);
...
...
@@ -1021,3 +1051,17 @@ class CapturingAppDomain extends AppDomain {
throwToolExit
(
''
);
}
}
class
FakeAnsiTerminal
extends
Fake
implements
AnsiTerminal
{
@override
bool
usesTerminalUi
=
false
;
/// A list of all the calls to the [singleCharMode] setter.
List
<
bool
>
setSingleCharModeHistory
=
<
bool
>[];
@override
set
singleCharMode
(
bool
value
)
=>
setSingleCharModeHistory
.
add
(
value
);
@override
bool
get
singleCharMode
=>
setSingleCharModeHistory
.
last
;
}
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