Skip to content

Commit 7bbc35f

Browse files
committed
fix(simulator): do not process the lines in a log file
These are already application specific logs, so processing them further just causes us to lose information Fixes TIMOB-28549
1 parent d676e18 commit 7bbc35f

File tree

1 file changed

+9
-27
lines changed

1 file changed

+9
-27
lines changed

lib/simulator.js

+9-27
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,6 @@ function launch(simHandleOrUDID, options, callback) {
17401740

17411741
function findTitaniumAppLogFile(next) {
17421742
const autoExitToken = options.autoExitToken || 'AUTO_EXIT';
1743-
const logRegExp = new RegExp(' ' + simHandle.appName + '\\[\\d+:\\d+\\] (.*)');
17441743
const crash1RegExp = /\*\*\* Terminating app/; // objective-c issue
17451744

17461745
if (watchSimHandle && options.launchWatchAppOnly) {
@@ -1753,41 +1752,24 @@ function launch(simHandleOrUDID, options, callback) {
17531752
let found = false;
17541753
let detectedCrash = false;
17551754
(function walk(dir) {
1756-
let processingJsonObject = false;
17571755
const logFile = path.join(dir, 'Documents', options.logFilename);
17581756
if (fs.existsSync(logFile)) {
17591757
emitter.emit('log-debug', __('Found application log file: %s', logFile));
17601758
logFileTail = new Tail(logFile, '\n', { interval: 500, start: 0 });
17611759
logFileTail.on('line', function (msg) {
1762-
const m = msg.match(logRegExp);
17631760

1764-
if (!m && processingJsonObject) {
1765-
emitter.emit('log-file', msg);
1766-
}
1767-
1768-
if (!m && processingJsonObject && msg.startsWith('}')) {
1769-
processingJsonObject = false;
1770-
}
1771-
1772-
if (m) {
1773-
1774-
if (m[1].endsWith('{')) {
1775-
processingJsonObject = true;
1776-
}
1761+
emitter.emit('log-file', msg);
17771762

1778-
emitter.emit('log-file', m[1]);
1779-
1780-
if (options.autoExit && msg.indexOf(autoExitToken) !== -1) {
1781-
emitter.emit('log-debug', __('Found "%s" token, stopping simulator', autoExitToken));
1782-
// stopping the simulator will cause the "close" event to fire
1783-
stop(simHandle, function () {
1784-
cleanupAndEmit('app-quit');
1785-
});
1786-
return;
1787-
}
1763+
if (options.autoExit && msg.indexOf(autoExitToken) !== -1) {
1764+
emitter.emit('log-debug', __('Found "%s" token, stopping simulator', autoExitToken));
1765+
// stopping the simulator will cause the "close" event to fire
1766+
stop(simHandle, function () {
1767+
cleanupAndEmit('app-quit');
1768+
});
1769+
return;
17881770
}
17891771

1790-
if (!detectedCrash && simHandle.type === 'ios' && ((m && crash1RegExp.test(m[1])))) {
1772+
if (!detectedCrash && simHandle.type === 'ios' && ((msg && crash1RegExp.test(msg)))) {
17911773
detectedCrash = true;
17921774
// wait 1 second for the potential crash log to be written
17931775
setTimeout(function () {

0 commit comments

Comments
 (0)