Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (this.uiAutoClient) {
await this.uiAutoClient.shutdown();
}
if (this.instruments) {
try {
await this.instruments.shutdown();
} catch (err) {
logger.error(`Instruments didn't shut down. ${err}`);
}
}
if (this.caps && this.caps.customSSLCert && !this.isRealDevice()) {
logger.debug(`Uninstalling ssl certificate for udid '${this.sim.udid}'`);
await uninstallSSLCert(this.caps.customSSLCert, this.sim.udid);
}
if (this.opts.enableAsyncExecuteFromHttps && !this.isRealDevice()) {
await this.stopHttpsAsyncServer();
}
this.uiAutoClient = null;
this.instruments = null;
this.realDevice = null;
// postcleanup
this.curCoords = null;
this.opts.curOrientation = null;
if (!_.isEmpty(this.logs)) {
await this.logs.syslog.stopCapture();
this.logs = {};
helpers.stopHttpsAsyncServer = async function stopHttpsAsyncServer () {
logger.debug('Stopping https server for async responses');
if (this.opts.sslServer) {
await this.opts.sslServer.close();
}
await uninstallSSLCert(this.opts.httpsServerCertificate, this.opts.udid);
};