File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ import type { CliEnv } from '../types/env'
1616export 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 ,
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import os from 'os'
22
33import open from 'open'
44
5+ import { getCliEnv } from './env'
56import { logger } from './logger'
67
78/**
@@ -16,9 +17,8 @@ import { logger } from './logger'
1617 */
1718export 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.' ,
You can’t perform that action at this time.
0 commit comments