Support wireless debugging for iOS 12 or earlier (#141439)
`idevicesyslog` requires the `--network` flag to obtain logs for iOS devices when wirelessly paired.
When running Flutter on devices with iOS 12 or earlier versions, [the `idevicesyslog` command is used.](5931b4f21d/packages/flutter_tools/lib/src/ios/devices.dart (L1269-L1277)
).
Related Issue: #15072
Related PRs: #118104, #118895, #60623
This commit is contained in:
parent
990e2a562b
commit
23385468a8
@ -1392,7 +1392,7 @@ class IOSDeviceLogReader extends DeviceLogReader {
|
||||
if (!useSyslogLogging) {
|
||||
return;
|
||||
}
|
||||
_iMobileDevice.startLogger(_deviceId).then<void>((Process process) {
|
||||
_iMobileDevice.startLogger(_deviceId, _isWirelesslyConnected).then<void>((Process process) {
|
||||
process.stdout.transform<String>(utf8.decoder).transform<String>(const LineSplitter()).listen(_newSyslogLineHandler());
|
||||
process.stderr.transform<String>(utf8.decoder).transform<String>(const LineSplitter()).listen(_newSyslogLineHandler());
|
||||
process.exitCode.whenComplete(() {
|
||||
|
@ -90,12 +90,17 @@ class IMobileDevice {
|
||||
late final bool isInstalled = _processManager.canRun(_idevicescreenshotPath);
|
||||
|
||||
/// Starts `idevicesyslog` and returns the running process.
|
||||
Future<Process> startLogger(String deviceID) {
|
||||
Future<Process> startLogger(
|
||||
String deviceID,
|
||||
bool isWirelesslyConnected,
|
||||
) {
|
||||
return _processUtils.start(
|
||||
<String>[
|
||||
_idevicesyslogPath,
|
||||
'-u',
|
||||
deviceID,
|
||||
if (isWirelesslyConnected)
|
||||
'--network',
|
||||
],
|
||||
environment: Map<String, String>.fromEntries(
|
||||
<MapEntry<String, String>>[_dyLdLibEntry]
|
||||
|
@ -44,6 +44,62 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
group('startLogger', () {
|
||||
testWithoutContext('starts idevicesyslog when USB connected', () async {
|
||||
final FakeProcessManager fakeProcessManager = FakeProcessManager.list(
|
||||
<FakeCommand>[
|
||||
const FakeCommand(
|
||||
command: <String>['HostArtifact.idevicesyslog', '-u', '1234'],
|
||||
environment: <String, String>{
|
||||
'DYLD_LIBRARY_PATH': '/path/to/libraries'
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
final IMobileDevice iMobileDevice = IMobileDevice(
|
||||
artifacts: artifacts,
|
||||
cache: cache,
|
||||
processManager: fakeProcessManager,
|
||||
logger: logger,
|
||||
);
|
||||
|
||||
await iMobileDevice.startLogger(
|
||||
'1234',
|
||||
false,
|
||||
);
|
||||
expect(fakeProcessManager, hasNoRemainingExpectations);
|
||||
});
|
||||
|
||||
testWithoutContext('starts idevicesyslog when wirelessly connected', () async {
|
||||
final FakeProcessManager fakeProcessManager = FakeProcessManager.list(
|
||||
<FakeCommand>[
|
||||
const FakeCommand(
|
||||
command: <String>[
|
||||
'HostArtifact.idevicesyslog', '-u', '1234', '--network'
|
||||
],
|
||||
environment: <String, String>{
|
||||
'DYLD_LIBRARY_PATH': '/path/to/libraries'
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
final IMobileDevice iMobileDevice = IMobileDevice(
|
||||
artifacts: artifacts,
|
||||
cache: cache,
|
||||
processManager: fakeProcessManager,
|
||||
logger: logger,
|
||||
);
|
||||
|
||||
await iMobileDevice.startLogger(
|
||||
'1234',
|
||||
true,
|
||||
);
|
||||
expect(fakeProcessManager, hasNoRemainingExpectations);
|
||||
});
|
||||
});
|
||||
|
||||
group('screenshot', () {
|
||||
late FakeProcessManager fakeProcessManager;
|
||||
late File outputFile;
|
||||
|
Loading…
x
Reference in New Issue
Block a user