Skip to content

Commit 57bfbd0

Browse files
committed
Fix infinite loop in fish launch script
Fixes #1236
1 parent 3cd9f6b commit 57bfbd0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

scripts/launch.fish

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,16 @@ function export_stdlib_path
2222
set -l current_dir (pwd)
2323

2424
set -l which_elixir_expr $argv[1]
25-
set -gx ELX_STDLIB_PATH (readlink_f (eval $which_elixir_expr) | string replace -r '(.*)\/bin\/elixir' '$1')
25+
# Separate evaluation from readlink_f call to avoid infinite loop
26+
# when elixir is not found
27+
set -l stdlib_path (eval $which_elixir_expr 2>/dev/null)
28+
29+
# Only proceed if elixir was found
30+
if test -n "$stdlib_path"
31+
set -l stdlib_real_path (readlink_f "$stdlib_path")
32+
set -gx ELX_STDLIB_PATH (echo $stdlib_real_path | string replace -r '(.*)\/bin\/elixir' '$1')
33+
end
34+
2635
# readlink_f changes the current directory (since fish doesn't have
2736
# subshells), so it needs to be restored.
2837
cd $current_dir

0 commit comments

Comments
 (0)