From a3f47978bcf1b821c572f8db3e23ce119debd281 Mon Sep 17 00:00:00 2001 From: CanOfSocks <100449497+CanOfSocks@users.noreply.github.com> Date: Tue, 19 Sep 2023 07:36:57 +1000 Subject: [PATCH] Update Video - Inject HDR10+ metadata.js Changed order of error processing to help catch unrecognised errors --- .../Video/Video - Inject HDR10+ metadata.js | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/Scripts/Flow/Video/Video - Inject HDR10+ metadata.js b/Scripts/Flow/Video/Video - Inject HDR10+ metadata.js index 4e65e91..432e656 100644 --- a/Scripts/Flow/Video/Video - Inject HDR10+ metadata.js +++ b/Scripts/Flow/Video/Video - Inject HDR10+ metadata.js @@ -113,15 +113,19 @@ function Script(FailFlowOnNoInject) { } function processLogs(process, FailFlowOnNoInject) { - if (process.standardOutput) { - //catch errors in stdout - if (`${process.standardOutput}`.toLowerCase().includes("error") && FailFlowOnNoInject && process.exitCode === 0) { + //Logger.ILog("Exit code: " + process.exitCode) + if (process.exitCode !== 0) { + Logger.ELog('Failed with errorcode: ' + process.exitCode); + if (FailFlowOnNoInject) { + Logger.ILog("Failing flow") return -1; } - else{ - return 0; + else { + Logger.ILog("Continuing flow execution") + return 2; } - } + } + if (process.standardError) { Logger.ELog('Standard error: ' + process.standardError); if (FailFlowOnNoInject) { @@ -131,16 +135,18 @@ function processLogs(process, FailFlowOnNoInject) { return 2; } } - - if (process.exitCode !== 0) { - Logger.ELog('Failed with errorcode: ' + process.exitCode); - if (FailFlowOnNoInject) { - Logger.ILog("Failing flow") + + if (process.standardOutput) { + //catch errors in stdout + if (`${process.standardOutput}`.toLowerCase().includes("error") && FailFlowOnNoInject && process.exitCode === 0) { return -1; } - else { - Logger.ILog("Continuing flow execution") + else if(/error/i.test(process.standardOutput) === true && process.exitCode === 0){ return 2; } + else{ + return 0; + } } -} \ No newline at end of file + +}