fix(desktop): resolve login shell when loading env (#26449)
Co-authored-by: Brendan Allan <14191578+Brendonovich@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, test } from "bun:test"
|
||||
|
||||
import { isNushell, mergeShellEnv, parseShellEnv } from "./shell-env"
|
||||
import { isNushell, mergeShellEnv, parseShellEnv, resolveUserShell } from "./shell-env"
|
||||
|
||||
describe("shell env", () => {
|
||||
test("parseShellEnv supports null-delimited pairs", () => {
|
||||
@@ -34,6 +34,13 @@ describe("shell env", () => {
|
||||
expect(env.OPENCODE_CLIENT).toBe("desktop")
|
||||
})
|
||||
|
||||
test("resolveUserShell falls back to the login shell before /bin/sh", () => {
|
||||
expect(resolveUserShell("/custom/env-shell", "/bin/zsh")).toBe("/custom/env-shell")
|
||||
expect(resolveUserShell(undefined, "/bin/zsh")).toBe("/bin/zsh")
|
||||
expect(resolveUserShell(undefined, "unknown")).toBe("/bin/sh")
|
||||
expect(resolveUserShell(undefined, undefined)).toBe("/bin/sh")
|
||||
})
|
||||
|
||||
test("isNushell handles path and binary name", () => {
|
||||
expect(isNushell("nu")).toBe(true)
|
||||
expect(isNushell("/opt/homebrew/bin/nu")).toBe(true)
|
||||
|
||||
Reference in New Issue
Block a user