Add logs support for physical devices
Summary: There's a bit of an oddity with `idb` that the `stream` parameter is implied even though the docs say otherwise and if you try to use it, it'll give you a strange Python error. That's likely why we never implemented it. Now, it works just as it does using local tooling. Reviewed By: mweststrate Differential Revision: D26228036 fbshipit-source-id: e20cb31167170ba0501e2929ed129305cb9aaf2c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
05acdc99b0
commit
e788bb09be
@@ -79,9 +79,6 @@ export default class IOSDevice extends BaseDevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
startLogListener(retries: number = 3) {
|
startLogListener(retries: number = 3) {
|
||||||
if (this.deviceType === 'physical') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (retries === 0) {
|
if (retries === 0) {
|
||||||
console.warn('Attaching iOS log listener continuously failed.');
|
console.warn('Attaching iOS log listener continuously failed.');
|
||||||
return;
|
return;
|
||||||
@@ -91,6 +88,22 @@ export default class IOSDevice extends BaseDevice {
|
|||||||
? ['--set', process.env.DEVICE_SET_PATH]
|
? ['--set', process.env.DEVICE_SET_PATH]
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
|
const extraArgs = [
|
||||||
|
'--style',
|
||||||
|
'json',
|
||||||
|
'--predicate',
|
||||||
|
'senderImagePath contains "Containers"',
|
||||||
|
'--debug',
|
||||||
|
'--info',
|
||||||
|
];
|
||||||
|
|
||||||
|
if (this.deviceType === 'physical') {
|
||||||
|
this.log = child_process.spawn(
|
||||||
|
'idb',
|
||||||
|
['log', '--udid', this.serial, '--', ...extraArgs],
|
||||||
|
{},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
this.log = child_process.spawn(
|
this.log = child_process.spawn(
|
||||||
'xcrun',
|
'xcrun',
|
||||||
[
|
[
|
||||||
@@ -100,15 +113,11 @@ export default class IOSDevice extends BaseDevice {
|
|||||||
this.serial,
|
this.serial,
|
||||||
'log',
|
'log',
|
||||||
'stream',
|
'stream',
|
||||||
'--style',
|
...extraArgs,
|
||||||
'json',
|
|
||||||
'--predicate',
|
|
||||||
'senderImagePath contains "Containers"',
|
|
||||||
'--info',
|
|
||||||
'--debug',
|
|
||||||
],
|
],
|
||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
this.log.on('error', (err: Error) => {
|
this.log.on('error', (err: Error) => {
|
||||||
console.error('iOS log tailer error', err);
|
console.error('iOS log tailer error', err);
|
||||||
|
|||||||
Reference in New Issue
Block a user