Skip to content

Commit

Permalink
Fixed bug in run_with_env in the way that it was 'purging' modules cu…
Browse files Browse the repository at this point in the history
…rrently 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
  • Loading branch information
nathankw committed Aug 5, 2014
1 parent bd36b37 commit 320099a
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions scripts/run_with_env
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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;

Expand Down

0 comments on commit 320099a

Please sign in to comment.