asticode / go-astilectron-bundler

Bundle your Astilectron app with ease
MIT License
127 stars 67 forks source link

Running as root without --no-sandbox is not supported. See https://crbug.com/638180. #94

Closed vivekvardha closed 3 years ago

vivekvardha commented 3 years ago

I am facing the error in title when I try to run the app with sudo privileges.

I created the new window as follows.

    var w *astilectron.Window
    if w, err = a.NewWindow("sample/logs.html", &astilectron.WindowOptions{
        Center:   astikit.BoolPtr(true),
        Height:   astikit.IntPtr(700),
        Width:    astikit.IntPtr(700),
        MinWidth: astikit.IntPtr(100),
        **WebPreferences: &astilectron.WebPreferences{Sandbox: astikit.BoolPtr(false)}**,
    }); err != nil {
        log.Println(fmt.Sprintf("main: new window failed: %w", err))
    }

By initializing Sandbox under WebPreferences to 'false', I thought it would solve the problem but it did not work. Any leads to fix/workaround this would be of great help.

asticode commented 3 years ago

You could try using ElectronSwitches. Basically they are flags you can provide to Electron.

In your case you could try setting it to []string{"--no-sandbox"}

vivekvardha commented 3 years ago

@asticode thanks a lot for the quick input. It worked :)

asticode commented 3 years ago

Cheers