mirror of
https://github.com/alex8088/electron-vite.git
synced 2025-10-13 02:12:13 +08:00
append the --no-sandbox
when running with root user
This commit is contained in:
parent
2360d502a4
commit
122dfbfe14
@ -1,5 +1,6 @@
|
|||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
import fs from 'node:fs'
|
import fs from 'node:fs'
|
||||||
|
import os from 'node:os'
|
||||||
import { createRequire } from 'node:module'
|
import { createRequire } from 'node:module'
|
||||||
import { type ChildProcess, spawn } from 'node:child_process'
|
import { type ChildProcess, spawn } from 'node:child_process'
|
||||||
|
|
||||||
@ -122,6 +123,10 @@ export function startElectron(root: string | undefined): ChildProcess {
|
|||||||
|
|
||||||
const args: string[] = []
|
const args: string[] = []
|
||||||
|
|
||||||
|
if (os.userInfo().uid == 0 && isDev) {
|
||||||
|
args.push(`--no-sandbox`);
|
||||||
|
}
|
||||||
|
|
||||||
if (!!process.env.REMOTE_DEBUGGING_PORT && isDev) {
|
if (!!process.env.REMOTE_DEBUGGING_PORT && isDev) {
|
||||||
args.push(`--remote-debugging-port=${process.env.REMOTE_DEBUGGING_PORT}`)
|
args.push(`--remote-debugging-port=${process.env.REMOTE_DEBUGGING_PORT}`)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user