From 320099ad41dfbdee9e3fe55998c10971941fd13a Mon Sep 17 00:00:00 2001 From: nathankw Date: Mon, 4 Aug 2014 17:11:03 -0700 Subject: [PATCH] Fixed bug in run_with_env in the way that it was 'purging' modules currently loaded in a user's env. It was looping through all loaded modules and doing 'module unload' on each, which is buggy when some modules setup environment variables that other modules depend on. Switched to using 'module purge' instead, which works properly. -nw --- scripts/run_with_env | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/scripts/run_with_env b/scripts/run_with_env index 21fe1ef..24746c3 100755 --- a/scripts/run_with_env +++ b/scripts/run_with_env @@ -64,21 +64,6 @@ sub module_list { return @mods; } -# Define a better module("purge"): one that works. -sub module_purge { - # - # NOTE: "purge" is broken as of 3.2.8 -- fine as of 3.2.10. - # - print STDERR "Purging modules...\n" if $verbose; - module("purge"); - - # Get list of modules and remove each one. - #for my $mod (module_list()) { - # print STDERR "Removing module: $mod\n" if $verbose; - # module("rm $mod"); - #} -} - if (@ARGV == 0) { print "Usage: $0 [options] cmd args ...\n"; print " --module MODULE load the named environment module\n"; @@ -95,8 +80,9 @@ die "$0: missing command\n" if (@ARGV == 0); # Remove the currently loaded modules. -module_purge(); - +print STDERR "Purging modules...\n" if $verbose; +# NOTE: "purge" is broken as of 3.2.8 -- fine as of 3.2.10. +module("purge"); # Use a hash to keep track of all the modules being loaded. my %module_hash;