From d4c3725f88d9cb7100191c195eb04455412c78c7 Mon Sep 17 00:00:00 2001 From: Simon Fayer Date: Thu, 12 Sep 2024 14:58:52 +0200 Subject: [PATCH] sweep: #7785 Avoid incorrect error strings in Workflow execute --- src/DIRAC/Workflow/Modules/ModuleBase.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/DIRAC/Workflow/Modules/ModuleBase.py b/src/DIRAC/Workflow/Modules/ModuleBase.py index ee18ff3288e..ab7fc572012 100644 --- a/src/DIRAC/Workflow/Modules/ModuleBase.py +++ b/src/DIRAC/Workflow/Modules/ModuleBase.py @@ -139,7 +139,12 @@ def execute(self): # In this case the RuntimeError is supposed to return in rte[1] an error code (possibly from DErrno) self.log.error(rte.args[0]) self.setApplicationStatus(rte.args[0]) - return S_ERROR(rte.args[1], rte.args[0]) # rte[1] should be an error code + # rte.args[1] may be a shell exit code, not an error code: If we pass it to S_ERROR directly + # it will prefix the error message with the wrong description in that case. + # Instead we set the Errno manually afterwards which leaves the message unchanged. + res = S_ERROR(rte.args[0]) + res["Errno"] = rte.args[1] + return res # If we are here it is just a string self.log.error(rte)