last exit info formatting
This commit is contained in:
1 parent
0c79dc8d37
commit
34c6653877
2 files changed
+11
-8
No files matched your search
@@ -28,12 +28,10 @@ namespace Logger
|
||||
msg += `media_player_state: ${lastExitInfo.media_player_state}\n`
|
||||
msg += `mem_limit: ${lastExitInfo.mem_limit}\n`
|
||||
|
||||
' Sometimes lastExitInfo.console_log would contain 'AppExitComplete', which
|
||||
' is used to detect test runner exits. So we don't log it in test mode.
|
||||
#if TEST_MODE
|
||||
#else
|
||||
msg += `console_log:\n${lastExitInfo.console_log}\n`
|
||||
#end if
|
||||
' The echo is the PREVIOUS run's console — '| ' marks each line so consumers can skip it
|
||||
' when scanning live output.
|
||||
consoleLog = `${lastExitInfo.console_log}`
|
||||
msg += `console_log:\n| ` + consoleLog.Replace(chr(10), `\n| `) + `\n`
|
||||
|
||||
msg += `********** End Last Exit Info **********\n`
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ process.on('uncaughtException', (error, origin) => {
|
||||
await rokuDeploy.publish(options);
|
||||
|
||||
console.log('Waiting for test to finish');
|
||||
let data = await readFromTelnetUntil(telnet, timeout);
|
||||
let data = withoutQuotedLines(await readFromTelnetUntil(telnet, timeout));
|
||||
|
||||
if (reportOnly) {
|
||||
data = parseTestReport(data);
|
||||
@@ -132,6 +132,11 @@ function startTelnetClientAsync(host, port, timeoutSeconds = 2) {
|
||||
});
|
||||
}
|
||||
|
||||
// Lines starting with '| ' are the app quoting the previous run's console (Last Exit Info), not live output.
|
||||
function withoutQuotedLines(text) {
|
||||
return text.split('\n').filter((line) => !line.startsWith('| ')).join('\n');
|
||||
}
|
||||
|
||||
function readFromTelnetUntil(connection, timeoutSeconds = 20, endToken = 'AppExitComplete') {
|
||||
return new Promise((resolve, reject) => {
|
||||
let data = '';
|
||||
@@ -148,7 +153,7 @@ function readFromTelnetUntil(connection, timeoutSeconds = 20, endToken = 'AppExi
|
||||
clearTimeout(timeoutID);
|
||||
|
||||
data += chunk.toString();
|
||||
if (data.includes(endToken)) {
|
||||
if (withoutQuotedLines(data).includes(endToken)) {
|
||||
resolve(data);
|
||||
connection.end();
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user