From 74d7d7a8c58e40b19d8d10b0af4f0b59c9524eb2 Mon Sep 17 00:00:00 2001 From: Paolo Di Tommaso Date: Fri, 5 Apr 2024 11:47:13 +0200 Subject: [PATCH] Fix exception handling in local executor [ci fast] Signed-off-by: Paolo Di Tommaso --- .../nextflow/executor/local/NativeTaskHandler.groovy | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/nextflow/src/main/groovy/nextflow/executor/local/NativeTaskHandler.groovy b/modules/nextflow/src/main/groovy/nextflow/executor/local/NativeTaskHandler.groovy index bb7b7804d8..910a4248e0 100644 --- a/modules/nextflow/src/main/groovy/nextflow/executor/local/NativeTaskHandler.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/executor/local/NativeTaskHandler.groovy @@ -17,6 +17,7 @@ package nextflow.executor.local +import java.lang.reflect.InvocationTargetException import java.util.concurrent.Callable import java.util.concurrent.Future @@ -91,11 +92,15 @@ class NativeTaskHandler extends TaskHandler { boolean checkIfCompleted() { if( isRunning() && result.isDone() ) { status = TaskStatus.COMPLETED - if( result.get() instanceof Throwable ) { - task.error = (Throwable)result.get() + final ret = result.get() + if( ret instanceof InvocationTargetException ) { + task.error = ret.cause + } + else if( ret instanceof Throwable ) { + task.error = (Throwable)ret } else { - task.stdout = result.get() + task.stdout = ret } return true }