Skip to content

Commit e3ea66f

Browse files
committed
fix dumb rule
1 parent f245a02 commit e3ea66f

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

cli/src/types/env.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ export type CliEnv = BaseEnv & {
2626
SSH_TTY?: string
2727
SSH_CONNECTION?: string
2828

29+
// Display server detection (Linux headless check)
30+
DISPLAY?: string
31+
WAYLAND_DISPLAY?: string
32+
2933
// Terminal-specific
3034
KITTY_WINDOW_ID?: string
3135
SIXEL_SUPPORT?: string

cli/src/utils/env.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ import type { CliEnv } from '../types/env'
1616
export const getCliEnv = (): CliEnv => ({
1717
...getBaseEnv(),
1818

19+
// Display server detection (Linux headless check)
20+
DISPLAY: process.env.DISPLAY,
21+
WAYLAND_DISPLAY: process.env.WAYLAND_DISPLAY,
22+
1923
// Terminal detection (for tmux/screen passthrough)
2024
TERM: process.env.TERM,
2125
TMUX: process.env.TMUX,

cli/src/utils/open-url.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import os from 'os'
22

33
import open from 'open'
44

5+
import { getCliEnv } from './env'
56
import { logger } from './logger'
67

78
/**
@@ -16,9 +17,8 @@ import { logger } from './logger'
1617
*/
1718
export async function safeOpen(url: string): Promise<boolean> {
1819
if (os.platform() === 'linux') {
19-
const hasDisplay = Boolean(
20-
process.env.DISPLAY || process.env.WAYLAND_DISPLAY,
21-
)
20+
const env = getCliEnv()
21+
const hasDisplay = Boolean(env.DISPLAY || env.WAYLAND_DISPLAY)
2222
if (!hasDisplay) {
2323
logger.warn(
2424
'No display server detected (DISPLAY / WAYLAND_DISPLAY unset). Skipping browser open.',

0 commit comments

Comments
 (0)