Skip to content

Commit e724547

Browse files
author
Matteo Crippa
committed
improved regexp
1 parent 14c020b commit e724547

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/flutter_tools/lib/src/protocol_discovery.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,13 @@ class ProtocolDiscovery {
6060
void _handleLine(String line) {
6161
Uri uri;
6262

63-
final RegExp r = new RegExp('$serviceName (http://[^ \n]+)');
63+
final RegExp r =
64+
new RegExp('${RegExp.escape(serviceName)} (.*) (http://[^ \n]+)');
6465
final Match match = r.firstMatch(line);
6566

6667
if (match != null) {
6768
try {
68-
uri = Uri.parse(match[1]);
69+
uri = Uri.parse(match[2]);
6970
} catch (error) {
7071
_stopScrapingLogs();
7172
_completer.completeError(error);
@@ -77,6 +78,9 @@ class ProtocolDiscovery {
7778
_stopScrapingLogs();
7879
_completer.complete(_forwardPort(uri));
7980
}
81+
82+
_stopScrapingLogs();
83+
_completer.completeError('uri not found');
8084
}
8185

8286
Future<Uri> _forwardPort(Uri deviceUri) async {

0 commit comments

Comments
 (0)