mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/mihomo-party-org/clash-party.git
synced 2026-09-20 08:03:39 +08:00
fix: disable GPU sandbox for elevated Windows startup
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { spawn, exec } from 'child_process'
|
||||
import { spawn, exec, execSync } from 'child_process'
|
||||
import { promisify } from 'util'
|
||||
import { stat } from 'fs/promises'
|
||||
import { existsSync } from 'fs'
|
||||
@@ -54,6 +54,20 @@ export function setupPlatformSpecifics(): void {
|
||||
if (process.platform === 'win32' && !exePath().startsWith('C') && electronMajor < 38) {
|
||||
app.commandLine.appendSwitch('in-process-gpu')
|
||||
}
|
||||
|
||||
if (process.platform === 'win32' && isWindowsElevatedSync()) {
|
||||
app.commandLine.appendSwitch('disable-gpu-sandbox')
|
||||
}
|
||||
}
|
||||
|
||||
function isWindowsElevatedSync(): boolean {
|
||||
if (process.platform !== 'win32') return false
|
||||
try {
|
||||
execSync('fltmc', { stdio: 'ignore', windowsHide: true })
|
||||
return true
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export function setupAppLifecycle(): void {
|
||||
|
||||
Reference in New Issue
Block a user