Dispose iOS logs if logs plugin is not connected
Summary: See D27047041 (d293b2b0e5) for more details. This diff makes sure the log listener is disposed if the Logs plugin is disabled / the logging is paused, rather than keeping the connection open all time.
Reviewed By: nikoant
Differential Revision: D27083966
fbshipit-source-id: 6f157c237519a0fde9591f1c2033621858863de0
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9d3c48fd84
commit
4f70219a47
@@ -45,6 +45,7 @@ export default class IOSDevice extends BaseDevice {
|
|||||||
buffer: string;
|
buffer: string;
|
||||||
private recordingProcess?: ChildProcess;
|
private recordingProcess?: ChildProcess;
|
||||||
private recordingLocation?: string;
|
private recordingLocation?: string;
|
||||||
|
private iOSBridge: IOSBridge;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
iOSBridge: IOSBridge,
|
iOSBridge: IOSBridge,
|
||||||
@@ -55,7 +56,7 @@ export default class IOSDevice extends BaseDevice {
|
|||||||
super(serial, deviceType, title, 'iOS');
|
super(serial, deviceType, title, 'iOS');
|
||||||
this.icon = 'mobile';
|
this.icon = 'mobile';
|
||||||
this.buffer = '';
|
this.buffer = '';
|
||||||
this.startLogListener(iOSBridge);
|
this.iOSBridge = iOSBridge;
|
||||||
}
|
}
|
||||||
|
|
||||||
async screenshot(): Promise<Buffer> {
|
async screenshot(): Promise<Buffer> {
|
||||||
@@ -81,10 +82,12 @@ export default class IOSDevice extends BaseDevice {
|
|||||||
exec(command);
|
exec(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
teardown() {
|
startLogging() {
|
||||||
if (this.log) {
|
this.startLogListener(this.iOSBridge);
|
||||||
this.log.kill();
|
}
|
||||||
}
|
|
||||||
|
stopLogging() {
|
||||||
|
this.log?.kill();
|
||||||
}
|
}
|
||||||
|
|
||||||
startLogListener(iOSBridge: IOSBridge, retries: number = 3) {
|
startLogListener(iOSBridge: IOSBridge, retries: number = 3) {
|
||||||
@@ -207,6 +210,11 @@ export default class IOSDevice extends BaseDevice {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disconnect() {
|
||||||
|
this.stopScreenCapture();
|
||||||
|
super.disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used to strip the initial output of the logging utility where it prints out settings.
|
// Used to strip the initial output of the logging utility where it prints out settings.
|
||||||
|
|||||||
Reference in New Issue
Block a user