modules icon indicating copy to clipboard operation
modules copied to clipboard

Allow modules to ommit exit 1 calls to mimik modules 3 behaviour

Open wenzler opened this issue 2 years ago • 5 comments

Describe the solution you'd like

Hey Xavier, I again have one of those nice requests :) We'd need to be able to turn off exit codes for modules, like it was in modules 3

Something like this maybe in

proc cleanupAndExit {code} {
....
  if {![getState inhibit_errreport]} {
     exit $code
  } else { exit 0 }
}

Describe alternatives you've considered

Seems nothing from siteconfig can influence this behavior, correct?

Thanks and BR Seb

wenzler avatar Sep 08 '22 15:09 wenzler

Hi @wenzler

Do you mean to get 0 exit code and the end of modulecmd.tcl code evaluation even if an error occurs ?

For instance:

$ module load unknown_module
ERROR: Unable to locate a modulefile for 'unknown_module'
$ echo $?
0

xdelaruelle avatar Sep 08 '22 18:09 xdelaruelle

Yes, exactly

wenzler avatar Sep 08 '22 18:09 wenzler

In siteconfig.tcl you may set the false_rendered state to indicate the shell code for exit code has already been produced:

setState false_rendered 1

xdelaruelle avatar Sep 08 '22 18:09 xdelaruelle

Works - thanks a lot!

Maybe something for the cookbook then? etc/siteconfig.tcl:

if {[info exists ::env(MODULES_NO_EXITCODES)]} { setState false_rendered 1 }

wenzler avatar Sep 09 '22 11:09 wenzler

Maybe something for the cookbook then? etc/siteconfig.tcl:

if {[info exists ::env(MODULES_NO_EXITCODES)]} {
setState false_rendered 1
}

This is not something I will work on, but I will accept such cookbook entry as contribution.

xdelaruelle avatar Sep 10 '22 05:09 xdelaruelle