fix(init): allow alternate Iris binary
This commit is contained in:
+6
-2
@@ -35,7 +35,7 @@ fi
|
|||||||
# prompt to complete, and exec'ing here would seize the tty from the real iris
|
# prompt to complete, and exec'ing here would seize the tty from the real iris
|
||||||
if [[ -o interactive ]] && [ -t 0 ] && [ -z "$IRIS_PID" ] && [ -z "$IRIS_RESCUE" ]; then
|
if [[ -o interactive ]] && [ -t 0 ] && [ -z "$IRIS_PID" ] && [ -z "$IRIS_RESCUE" ]; then
|
||||||
export IRIS_ACTIVE_SHELL="zsh"
|
export IRIS_ACTIVE_SHELL="zsh"
|
||||||
exec iris
|
exec "${IRIS_BIN:-iris}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Iris Autocomplete Hook
|
# Iris Autocomplete Hook
|
||||||
@@ -80,7 +80,7 @@ fi
|
|||||||
# prompt to complete, and exec'ing here would seize the tty from the real iris
|
# prompt to complete, and exec'ing here would seize the tty from the real iris
|
||||||
if [[ $- == *i* ]] && [ -t 0 ] && [ -z "$IRIS_PID" ] && [ -z "$IRIS_RESCUE" ]; then
|
if [[ $- == *i* ]] && [ -t 0 ] && [ -z "$IRIS_PID" ] && [ -z "$IRIS_RESCUE" ]; then
|
||||||
export IRIS_ACTIVE_SHELL="bash"
|
export IRIS_ACTIVE_SHELL="bash"
|
||||||
exec iris
|
exec "${IRIS_BIN:-iris}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Iris Autocomplete Hook
|
# Iris Autocomplete Hook
|
||||||
@@ -115,8 +115,12 @@ end
|
|||||||
|
|
||||||
if status is-interactive; and not set -q IRIS_PID; and not set -q IRIS_RESCUE
|
if status is-interactive; and not set -q IRIS_PID; and not set -q IRIS_RESCUE
|
||||||
set -gx IRIS_ACTIVE_SHELL "fish"
|
set -gx IRIS_ACTIVE_SHELL "fish"
|
||||||
|
if set -q IRIS_BIN
|
||||||
|
exec "$IRIS_BIN"
|
||||||
|
else
|
||||||
exec iris
|
exec iris
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Iris Autocomplete Hook
|
# Iris Autocomplete Hook
|
||||||
if set -q IRIS_PID; and set -q IRIS_FD
|
if set -q IRIS_PID; and set -q IRIS_FD
|
||||||
|
|||||||
+16
-1
@@ -41,7 +41,11 @@ func TestInitAutostartRequiresInteractiveShell(t *testing.T) {
|
|||||||
t.Run(shell, func(t *testing.T) {
|
t.Run(shell, func(t *testing.T) {
|
||||||
script := captureInitScript(t, shell)
|
script := captureInitScript(t, shell)
|
||||||
|
|
||||||
head, _, found := strings.Cut(script, "exec iris")
|
autostart := `exec "${IRIS_BIN:-iris}"`
|
||||||
|
if shell == "fish" {
|
||||||
|
autostart = `exec "$IRIS_BIN"`
|
||||||
|
}
|
||||||
|
head, _, found := strings.Cut(script, autostart)
|
||||||
if !found {
|
if !found {
|
||||||
t.Fatalf("%s init script has no autostart", shell)
|
t.Fatalf("%s init script has no autostart", shell)
|
||||||
}
|
}
|
||||||
@@ -57,3 +61,14 @@ func TestInitAutostartRequiresInteractiveShell(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestInitAutostartSupportsBinaryOverride(t *testing.T) {
|
||||||
|
for _, shell := range []string{"zsh", "bash", "fish"} {
|
||||||
|
t.Run(shell, func(t *testing.T) {
|
||||||
|
script := captureInitScript(t, shell)
|
||||||
|
if !strings.Contains(script, "IRIS_BIN") {
|
||||||
|
t.Fatalf("%s init script does not support IRIS_BIN", shell)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user