Skip to content


Browse files Browse the repository at this point in the history
fix: instead /tmp, use TMPDIR if defined
  • Loading branch information
imefisto authored and Stratus3D committed May 9, 2022
1 parent 39909e0 commit 9113623
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lib/commands/reshim.bash
Expand Up @@ -145,12 +145,15 @@ remove_obsolete_shims() {
local formatted_shims
local formatted_exec_names

local temp_dir

# comm only takes to files, so we write this data to temp files so we can
# pass it to comm.
formatted_shims=$(mktemp /tmp/asdf-command-reshim-formatted-shims.XXXXXX)
formatted_shims="$(mktemp "$temp_dir/asdf-command-reshim-formatted-shims.XXXXXX")"
printf "%s\\n" "$shims" >"$formatted_shims"

formatted_exec_names=$(mktemp /tmp/asdf-command-reshim-formatted-exec-names.XXXXXX)
formatted_exec_names="$(mktemp "$temp_dir/asdf-command-reshim-formatted-exec-names.XXXXXX")"
printf "%s\\n" "$exec_names" >"$formatted_exec_names"

obsolete_shims=$(comm -23 "$formatted_shims" "$formatted_exec_names")
Expand Down
7 changes: 5 additions & 2 deletions lib/functions/versions.bash
Expand Up @@ -74,9 +74,12 @@ list_all_command() {
plugin_path=$(get_plugin_path "$plugin_name")
check_if_plugin_exists "$plugin_name"

local temp_dir

# Capture return code to allow error handling
std_out_file="$(mktemp "/tmp/asdf-command-list-all-${plugin_name}.stdout.XXXXXX")"
std_err_file="$(mktemp "/tmp/asdf-command-list-all-${plugin_name}.stderr.XXXXXX")"
std_out_file="$(mktemp "$temp_dir/asdf-command-list-all-${plugin_name}.stdout.XXXXXX")"
std_err_file="$(mktemp "$temp_dir/asdf-command-list-all-${plugin_name}.stderr.XXXXXX")"
return_code=0 && "${plugin_path}/bin/list-all" >"$std_out_file" 2>"$std_err_file" || return_code=$?

if [[ $return_code -ne 0 ]]; then
Expand Down

0 comments on commit 9113623

Please sign in to comment.