()
| 165 | } |
| 166 | |
| 167 | export function detectDisplay(): void { |
| 168 | // Only detect display on Linux/UNIX. |
| 169 | if (os.platform() === 'win32' || os.platform() === 'darwin') { |
| 170 | return; |
| 171 | } |
| 172 | if (!process.env['DISPLAY']) { |
| 173 | try { |
| 174 | const result = execSync( |
| 175 | `ps -u $(id -u) -o pid= | xargs -I{} cat /proc/{}/environ 2>/dev/null | tr '\\0' '\\n' | grep -m1 '^DISPLAY=' | cut -d= -f2`, |
| 176 | ); |
| 177 | const display = result.toString('utf8').trim(); |
| 178 | process.env['DISPLAY'] = display; |
| 179 | } catch { |
| 180 | // no-op |
| 181 | } |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | export async function launch(options: McpLaunchOptions): Promise<Browser> { |
| 186 | const {channel, executablePath, headless, isolated} = options; |
no test coverage detected
searching dependent graphs…