fix desktop plugin startup without Bun
This commit is contained in:
@@ -1,6 +1,16 @@
|
||||
import type { OhMyOpenCodeConfig, TmuxConfig } from "./config"
|
||||
import { TmuxConfigSchema } from "./config/schema/tmux"
|
||||
|
||||
type RuntimeWithBun = typeof globalThis & {
|
||||
Bun?: {
|
||||
which(binary: string): string | null
|
||||
}
|
||||
}
|
||||
|
||||
function defaultWhich(binary: string): string | null {
|
||||
return (globalThis as RuntimeWithBun).Bun?.which(binary) ?? null
|
||||
}
|
||||
|
||||
export function isTmuxIntegrationEnabled(
|
||||
pluginConfig: { tmux?: { enabled?: boolean } | undefined },
|
||||
): boolean {
|
||||
@@ -8,7 +18,7 @@ export function isTmuxIntegrationEnabled(
|
||||
}
|
||||
|
||||
export function isInteractiveBashEnabled(
|
||||
which: (binary: string) => string | null = Bun.which,
|
||||
which: (binary: string) => string | null = defaultWhich,
|
||||
): boolean {
|
||||
return which("tmux") !== null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user