Make device debug info fetching fault tolerant

Summary:
Design doc: https://docs.google.com/document/d/1HLCFl46RfqG0o1mSt8SWrwf_HMfOCRg_oENioc1rkvQ/edit#

Some files on the devices could be unavailable due to lack of permissions (hello SELinux and enterprise builds of iOS apps). Instead of failing the export, we should fetch what we can.

Reviewed By: passy

Differential Revision: D40551931

fbshipit-source-id: 698e157b1283b9e959909b6439cd09d2dc8dc8d6
This commit is contained in:
Andrey Goncharov
2022-10-25 05:31:48 -07:00
committed by Facebook GitHub Bot
parent 80f947212b
commit e886427003
3 changed files with 84 additions and 50 deletions

View File

@@ -25,6 +25,7 @@ import {
FlipperServerConfig,
Logger,
FlipperServerExecOptions,
DeviceDebugData,
} from 'flipper-common';
import {ServerDevice} from './devices/ServerDevice';
import {Base64} from 'js-base64';
@@ -611,10 +612,21 @@ export class FlipperServerImpl implements FlipperServer {
(device.info.os === 'Android' || device.info.os === 'iOS'),
)
.map((device) =>
(device as unknown as DebuggableDevice).readFlipperFolderForAllApps(),
(device as unknown as DebuggableDevice)
.readFlipperFolderForAllApps()
.catch((e) => {
console.warn(
'fetchDebugLogs -> could not fetch debug data',
device.info.serial,
e,
);
}),
),
);
return debugDataForEachDevice.flat();
return debugDataForEachDevice
.filter((item): item is DeviceDebugData[] => !!item)
.flat();
}
public async close() {