Skip to content

Commit

Permalink
Don't show error on not found launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
nui committed Apr 30, 2024
1 parent 5fd54c4 commit e491505
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions login.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ try_start_login_shell() {
local flags
local launcher
launcher="$1"

if [ ! -e "$launcher" ]; then
return
fi

if [ ! -x "$launcher" ]; then
>&2 echo "$launcher" is not executable
return 1
Expand All @@ -36,6 +41,11 @@ try_start_login_shell ~/.nmk/bin/nmk
try_start_login_shell ~/bin/nmk
try_start_login_shell ~/.nmk/nmk/target/debug/launcher

global_nmk=$(command -v nmk 2>/dev/null)
if [ -x "$global_nmk" ]; then
try_start_login_shell "$global_nmk"
fi

# If this line is reached, we didn't find candidate launcher, fallback to re-execute itself.
# N.B. MacOs doesn't have procfs, we silently fallback to /bin/sh
current_exe=$(readlink -f /proc/$$/exe)
Expand Down

0 comments on commit e491505

Please sign in to comment.