This commit is contained in:
@@ -108,14 +108,30 @@ export class SessionManager extends EventEmitter {
|
||||
}
|
||||
|
||||
static isAvailable(): boolean {
|
||||
try {
|
||||
execSync('which Xvfb', { stdio: 'ignore' });
|
||||
execSync('which x11vnc', { stdio: 'ignore' });
|
||||
execSync('which websockify', { stdio: 'ignore' });
|
||||
return true;
|
||||
} catch {
|
||||
// Use the POSIX shell builtin `command -v`, NOT the external `which` binary.
|
||||
// `which` is absent in some minimal images (e.g. debian-slim dropped it from
|
||||
// debianutils) and depends on PATH; relying on it caused "deps missing →
|
||||
// headless fallback" even when Xvfb/x11vnc/websockify were actually installed.
|
||||
// `command -v` is built into /bin/sh, so execSync (which runs via `/bin/sh -c`)
|
||||
// resolves each binary from the server process's own PATH.
|
||||
const required = ['Xvfb', 'x11vnc', 'websockify'];
|
||||
const missing: string[] = [];
|
||||
for (const bin of required) {
|
||||
try {
|
||||
execSync(`command -v ${bin}`, { stdio: 'ignore' });
|
||||
} catch {
|
||||
missing.push(bin);
|
||||
}
|
||||
}
|
||||
if (missing.length > 0) {
|
||||
logger.warn(
|
||||
`[SessionManager] noVNC display stack unavailable; not found on the server PATH: ${missing.join(', ')}. ` +
|
||||
`Browser/CAPTCHA live view (display_mode: novnc) falls back to headless. ` +
|
||||
`Install them (scripts/setup-novnc.sh) and ensure they are on the server process's PATH.`,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private cleanupOrphanedProcesses(): void {
|
||||
|
||||
Reference in New Issue
Block a user