Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (batchedLogs.length) {
try {
await fs.writeFile(
logFile,
batchedLogs.map((log) => `[${log.level}] ${log.msg}`).join('\n'),
{flag: 'a'}
);
win.webContents.send('appium-log-line', batchedLogs);
} catch (ign) { }
batchedLogs.splice(0, batchedLogs.length);
}
}, LOG_SEND_INTERVAL_MS);
try {
// set up the appium server running in this thread
server = await appiumServer(args, true);
await settings.set('SERVER_ARGS', args);
win.webContents.send('appium-start-ok');
} catch (e) {
win.webContents.send('appium-start-error', e.message);
try {
await server.close();
} catch (ign) {}
clearInterval(logWatcher);
}
});
}