From b5d9aa4b6eb6646f23aefe5f2b2b532a06f90aaa Mon Sep 17 00:00:00 2001 From: Anatoli-Kalbasin1 Date: Fri, 18 Oct 2024 16:46:11 +0200 Subject: [PATCH] fix Signed-off-by: Anatoli-Kalbasin1 --- .../zowe/zdevops/logic/SubmitJobOperation.kt | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/org/zowe/zdevops/logic/SubmitJobOperation.kt b/src/main/kotlin/org/zowe/zdevops/logic/SubmitJobOperation.kt index 420bec8..97868d6 100644 --- a/src/main/kotlin/org/zowe/zdevops/logic/SubmitJobOperation.kt +++ b/src/main/kotlin/org/zowe/zdevops/logic/SubmitJobOperation.kt @@ -92,13 +92,18 @@ fun submitJobSync( val fullLog = spoolFiles.joinToString { GetJobs(zosConnection).getSpoolContent(it) } val logPath = "$workspacePath/${finalResult.jobName}.${finalResult.jobId}" val file = File(logPath) - file.writeText(fullLog) - listener.logger.println(Messages.zdevops_declarative_ZOSJobs_got_log( - HyperlinkNote.encodeTo( - linkBuilder(buildUrl, finalResult.jobName, finalResult.jobId), - "${finalResult.jobName}.${finalResult.jobId}" - ) - )) + try { + file.writeText(fullLog) + listener.logger.println(Messages.zdevops_declarative_ZOSJobs_got_log( + HyperlinkNote.encodeTo( + linkBuilder(buildUrl, finalResult.jobName, finalResult.jobId), + "${finalResult.jobName}.${finalResult.jobId}" + ) + )) + } catch (ex: Exception) { + listener.logger.println("[WARNING] - Couldn't write the log to a file in workspace. The problem was: " + ex.message) + listener.logger.println("Posting logs here: \n$fullLog") + } } else { listener.logger.println(Messages.zdevops_no_spool_files(submitJobRsp.jobid)) }