MCPcopy
hub / github.com/ChromeDevTools/chrome-devtools-mcp / detectDisplay

Function detectDisplay

src/browser.ts:167–183  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

165}
166
167export 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
185export async function launch(options: McpLaunchOptions): Promise<Browser> {
186 const {channel, executablePath, headless, isolated} = options;

Callers 2

launchFunction · 0.85
browser.test.tsFile · 0.85

Calls 3

trimMethod · 0.80
platformMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…