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
76698a50
Unverified
Commit
76698a50
authored
Sep 22, 2020
by
Jonah Williams
Committed by
GitHub
Sep 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] dont crash if attach is given a bad debug uri (#66358)
parent
379a4e73
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
4 deletions
+24
-4
attach.dart
packages/flutter_tools/lib/src/commands/attach.dart
+4
-1
command_output_test.dart
...ter_tools/test/integration.shard/command_output_test.dart
+17
-0
common.dart
packages/flutter_tools/test/src/common.dart
+3
-3
No files found.
packages/flutter_tools/lib/src/commands/attach.dart
View file @
76698a50
...
...
@@ -141,7 +141,10 @@ class AttachCommand extends FlutterCommand {
if
(
argResults
[
'debug-uri'
]
==
null
)
{
return
null
;
}
final
Uri
uri
=
Uri
.
parse
(
stringArg
(
'debug-uri'
));
final
Uri
uri
=
Uri
.
tryParse
(
stringArg
(
'debug-uri'
));
if
(
uri
==
null
)
{
throwToolExit
(
'Invalid `--debug-uri`:
${stringArg('debug-uri')}
'
);
}
if
(!
uri
.
hasPort
)
{
throwToolExit
(
'Port not specified for `--debug-uri`:
$uri
'
);
}
...
...
packages/flutter_tools/test/integration.shard/command_output_test.dart
View file @
76698a50
...
...
@@ -153,4 +153,21 @@ void main() {
expect
(
versionInfo
,
containsPair
(
'flutterRoot'
,
isNotNull
));
});
testWithoutContext
(
'A tool exit is thrown for an invalid debug-uri in flutter attach'
,
()
async
{
final
String
flutterBin
=
fileSystem
.
path
.
join
(
getFlutterRoot
(),
'bin'
,
'flutter'
);
final
String
helloWorld
=
fileSystem
.
path
.
join
(
getFlutterRoot
(),
'examples'
,
'hello_world'
);
final
ProcessResult
result
=
await
processManager
.
run
(<
String
>[
flutterBin
,
...
getLocalEngineArguments
(),
'--show-test-device'
,
'attach'
,
'-d'
,
'flutter-tester'
,
'--debug-uri=http://127.0.0.1:3333*/'
,
],
workingDirectory:
helloWorld
);
expect
(
result
.
exitCode
,
1
);
expect
(
result
.
stderr
,
contains
(
'Invalid `--debug-uri`: http://127.0.0.1:3333*/'
));
});
}
packages/flutter_tools/test/src/common.dart
View file @
76698a50
...
...
@@ -58,13 +58,13 @@ String getFlutterRoot() {
Error
invalidScript
()
=>
StateError
(
'Could not determine flutter_tools/ path from script URL (
${globals.platform.script}
); consider setting FLUTTER_ROOT explicitly.'
);
Uri
scriptUri
;
switch
(
globals
.
platform
.
script
.
scheme
)
{
switch
(
platform
.
script
.
scheme
)
{
case
'file'
:
scriptUri
=
globals
.
platform
.
script
;
scriptUri
=
platform
.
script
;
break
;
case
'data'
:
final
RegExp
flutterTools
=
RegExp
(
r'(file://[^"]*[/\\]flutter_tools[/\\][^"]+\.dart)'
,
multiLine:
true
);
final
Match
match
=
flutterTools
.
firstMatch
(
Uri
.
decodeFull
(
globals
.
platform
.
script
.
path
));
final
Match
match
=
flutterTools
.
firstMatch
(
Uri
.
decodeFull
(
platform
.
script
.
path
));
if
(
match
==
null
)
{
throw
invalidScript
();
}
...
...
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