modulecmd: bugfix in tmp file setup/cleanup

This commit is contained in:
2021-05-07 16:40:08 +02:00
parent 183e7f40a2
commit bff9055b20
+3 -4
View File
@@ -1465,7 +1465,6 @@ subcommand_purge() {
local output=$("${modulecmd}" 'bash' 'purge' 2> "${tmpfile}")
local error=$( < "${tmpfile}")
${rm} "${tmpfile}"
if [[ "${error}" =~ ":ERROR:" ]]; then
local s=${error%%$'\n'*}
local error_txt='failed'
@@ -1755,8 +1754,6 @@ subcommand_search() {
func_print_line='print_line_csv'
}
local -r tmpfile=$1
if [[ "${opt_print_modulefiles}" == 'yes' ]]; then
print_modulefiles
elif [[ "${opt_print_csv}" == 'yes' ]]; then
@@ -1852,7 +1849,6 @@ subcommand_search() {
done
done
print_result "${tmpfile}"
${rm} -f "${tmpfile}"
}
while (( $# > 0 )); do
@@ -2277,6 +2273,9 @@ case ${subcommand} in
declare -r tmpfile=$( ${mktemp} /tmp/Pmodules.XXXXXX ) \
|| std::die 1 "Oops: unable to create tmp file!"
;;
* )
declare -r tmpfile=''
;;
esac
declare options