Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (thisSimHandle && thisSimHandle.simctl) {
appc.subprocess.run(thisSimHandle.simctl, ['erase', thisSimHandle.udid], function () {
logger.tio2('Resetting simulator');
});
};
setTimeout(function () {
next();
}, 1000);
} catch (ex) {
next(new Error('Results are not valid JSON'));
}
} else if (inTiMochaResult && line) {
tiMochaResults.push(line);
}
};
emitter = ioslib.simulator.launch(null, {
appPath: this.appDir,
hide: true,
logFilename: this.tiapp.guid + '.log'
}, function(msg, simHandle) {
thisSimHandle = simHandle;
})
.on('log-error', function (msg, simHandle) {
// system log error messages
logger.error('[' + simHandle.appName + '] ' + msg);
})
.on('log-debug', function (msg) {
logger['tio2-debug']('[ioslib] '.magenta + msg.replace(/(?:(\[[^\]]+\]) )*/, function (m) { return m.magenta; }));
})
.on('log-file', watch)
.on('app-quit', function (code) {
if (code) {
let simStarted = false,
lastLogger = 'debug';
const startLogTxt = __('Start simulator log'),
endLogTxt = __('End simulator log'),
levels = logger.getLevels(),
trimRE = new RegExp('^.*' + builder.tiapp.name + '\\[[^\\]]+\\]\\s*', 'g'),
logLevelRE = new RegExp('^(\u001b\\[\\d+m)?\\[?(' + levels.join('|') + '|log|timestamp)\\]?\\s*(\u001b\\[\\d+m)?(.*)', 'i');
function endLog() {
if (simStarted) {
logger.log(('-- ' + endLogTxt + ' ' + (new Array(75 - endLogTxt.length)).join('-')).grey + '\n');
simStarted = false;
}
}
ioslib.simulator
.launch(builder.simHandle, {
appPath: builder.xcodeAppDir,
focus: cli.argv['sim-focus'],
iosVersion: builder.iosSdkVersion,
killIfRunning: false, // it will only kill the simulator if the device udid is different
launchBundleId: cli.argv['launch-bundle-id'],
launchWatchApp: builder.hasWatchApp && cli.argv['launch-watch-app'],
launchWatchAppOnly: builder.hasWatchApp && cli.argv['launch-watch-app-only'],
logFilename: builder.tiapp.guid + '.log',
watchHandleOrUDID: builder.watchSimHandle,
watchAppName: cli.argv['watch-app-name']
})
.on('log-file', function (line) {
// Titanium app log messages
if (!simStarted) {
simStarted = true;
.on('app-quit', function (code) {
if (code) {
if (code instanceof ioslib.simulator.SimulatorCrash) {
logger.error(__n('Detected crash:', 'Detected multiple crashes:', code.crashFiles.length));
code.crashFiles.forEach(function (f) {
logger.error(' ' + f);
});
logger.error(__n('Note: this crash may or may not be related to running your app.', 'Note: these crashes may or may not be related to running your app.', code.crashFiles.length) + '\n');
} else {
logger.error(__('An error occurred running the iOS Simulator (exit code %s)', code));
}
}
endLog();
process.exit(0);
})
.on('exit', function () {
.on('app-quit', function (code) {
if (code) {
if (code instanceof ioslib.simulator.SimulatorCrash) {
logger.error('Detected crashes: ' + code.crashFiles.length);
logger.error('Note: Crashes may or may not be related to running your app.');
} else {
logger.error('An error occurred running the iOS Simulator (ios-sim exit code ' + code + ').');
}
}
})
.on('exit', function () {