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
8930e9b8
Unverified
Commit
8930e9b8
authored
Oct 08, 2021
by
Jenn Magder
Committed by
GitHub
Oct 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Catch FormatException parsing XCDevice._getAllDevices (#90967)
parent
b1126d87
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
xcdevice.dart
packages/flutter_tools/lib/src/macos/xcdevice.dart
+10
-3
xcode_test.dart
...es/flutter_tools/test/general.shard/macos/xcode_test.dart
+13
-0
No files found.
packages/flutter_tools/lib/src/macos/xcdevice.dart
View file @
8930e9b8
...
...
@@ -112,9 +112,16 @@ class XCDevice {
throwOnError:
true
,
);
if
(
result
.
exitCode
==
0
)
{
final
List
<
dynamic
>
listResults
=
json
.
decode
(
result
.
stdout
)
as
List
<
dynamic
>;
_cachedListResults
=
listResults
;
return
listResults
;
final
String
listOutput
=
result
.
stdout
;
try
{
final
List
<
dynamic
>
listResults
=
json
.
decode
(
listOutput
)
as
List
<
dynamic
>;
_cachedListResults
=
listResults
;
return
listResults
;
}
on
FormatException
{
// xcdevice logs errors and crashes to stdout.
_logger
.
printError
(
'xcdevice returned non-JSON response:
$listOutput
'
);
return
null
;
}
}
_logger
.
printTrace
(
'xcdevice returned an error:
\n
${result.stderr}
'
);
}
on
ProcessException
catch
(
exception
)
{
...
...
packages/flutter_tools/test/general.shard/macos/xcode_test.dart
View file @
8930e9b8
...
...
@@ -680,6 +680,19 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
macPlatform
,
});
testUsingContext
(
'handles bad output'
,()
async
{
fakeProcessManager
.
addCommand
(
const
FakeCommand
(
command:
<
String
>[
'xcrun'
,
'xcdevice'
,
'list'
,
'--timeout'
,
'2'
],
stdout:
'Something bad happened, not JSON'
,
));
final
List
<
IOSDevice
>
devices
=
await
xcdevice
.
getAvailableIOSDevices
();
expect
(
devices
,
isEmpty
);
expect
(
logger
.
errorText
,
contains
(
'xcdevice returned non-JSON response'
));
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
macPlatform
,
});
});
group
(
'diagnostics'
,
()
{
...
...
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