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 += `media_player_state: ${lastExitInfo.media_player_state}\n`
|
||||||
msg += `mem_limit: ${lastExitInfo.mem_limit}\n`
|
msg += `mem_limit: ${lastExitInfo.mem_limit}\n`
|
||||||
|
|
||||||
' Sometimes lastExitInfo.console_log would contain 'AppExitComplete', which
|
' The echo is the PREVIOUS run's console — '| ' marks each line so consumers can skip it
|
||||||
' is used to detect test runner exits. So we don't log it in test mode.
|
' when scanning live output.
|
||||||
#if TEST_MODE
|
consoleLog = `${lastExitInfo.console_log}`
|
||||||
#else
|
msg += `console_log:\n| ` + consoleLog.Replace(chr(10), `\n| `) + `\n`
|
||||||
msg += `console_log:\n${lastExitInfo.console_log}\n`
|
|
||||||
#end if
|
|
||||||
|
|
||||||
msg += `********** End Last Exit Info **********\n`
|
msg += `********** End Last Exit Info **********\n`
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ process.on('uncaughtException', (error, origin) => {
|
|||||||
await rokuDeploy.publish(options);
|
await rokuDeploy.publish(options);
|
||||||
|
|
||||||
console.log('Waiting for test to finish');
|
console.log('Waiting for test to finish');
|
||||||
let data = await readFromTelnetUntil(telnet, timeout);
|
let data = withoutQuotedLines(await readFromTelnetUntil(telnet, timeout));
|
||||||
|
|
||||||
if (reportOnly) {
|
if (reportOnly) {
|
||||||
data = parseTestReport(data);
|
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') {
|
function readFromTelnetUntil(connection, timeoutSeconds = 20, endToken = 'AppExitComplete') {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let data = '';
|
let data = '';
|
||||||
@@ -148,7 +153,7 @@ function readFromTelnetUntil(connection, timeoutSeconds = 20, endToken = 'AppExi
|
|||||||
clearTimeout(timeoutID);
|
clearTimeout(timeoutID);
|
||||||
|
|
||||||
data += chunk.toString();
|
data += chunk.toString();
|
||||||
if (data.includes(endToken)) {
|
if (withoutQuotedLines(data).includes(endToken)) {
|
||||||
resolve(data);
|
resolve(data);
|
||||||
connection.end();
|
connection.end();
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in new issue
Block a user