Skip to content

Commit 7ecdcb1

Browse files
goosewobblerclaude
andcommitted
fix: explicitly set DISPLAY env var for Tauri binary on Linux
Diagnostics revealed that the DISPLAY environment variable was not being propagated from the xvfb-run wrapper through ChromeDriver to the Tauri binary, causing GTK to fail with "cannot open display" errors. This commit adds explicit DISPLAY environment variable configuration in Chrome options, ensuring the Tauri binary can access the X server when running in CI environments with xvfb. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent e3bb206 commit 7ecdcb1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/tauri-service/src/launcher.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,23 @@ export default class TauriLaunchService {
107107
}
108108

109109
// Set up Chrome options to use the Tauri app binary
110+
// On Linux, ensure DISPLAY is set for xvfb
111+
const env: Record<string, string> = {};
112+
if (process.platform === 'linux') {
113+
// Use DISPLAY from environment if set, otherwise default to :99
114+
env.DISPLAY = process.env.DISPLAY || ':99';
115+
log.info(`Setting DISPLAY=${env.DISPLAY} for Tauri binary`);
116+
}
117+
110118
cap['goog:chromeOptions'] = {
111119
binary: appBinaryPath,
112120
args: chromeArgs,
121+
...(Object.keys(env).length > 0 && { env }),
113122
prefs: {
114123
'profile.password_manager_leak_detection': false,
115124
'profile.default_content_setting_values.notifications': 2,
116125
},
117-
};
126+
} as (typeof cap)['goog:chromeOptions'] & { env?: Record<string, string> };
118127

119128
// Disable WebDriver Bidi session
120129
cap['wdio:enforceWebDriverClassic'] = true;

0 commit comments

Comments
 (0)