sudo-prompt icon indicating copy to clipboard operation
sudo-prompt copied to clipboard

`sudo-prompt` fails to detect `pkexec` or `kdesudo` in "strictly" confined snap

Open Melvin-Abraham opened this issue 3 years ago • 0 comments

I am making an electron app which I am distributing as a "strictly" confined snap application. This app requires superuser privileges to run some commands, so I am using sudo-prompt. But it turns out that the command fails as it fails to find pkexec or kdesudo for authentication purpose. This does work in a "classic" snap though. Is there any way to get it working in a strictly confined snap?

Code Snippet

sudo.exec('snap refresh g-assist', {name: 'Google Assistant'}, (err, stdout, stderr) => {
    if (err) console.log(err);
    ...
});

Error Stacktrace

Error: Unable to find pkexec or kdesudo.
    at test (/snap/g-assist/x6/resources/app.asar/node_modules/sudo-prompt/index.js:205)
    at /snap/g-assist/x6/resources/app.asar/node_modules/sudo-prompt/index.js:212
    at FSReqCallback.oncomplete (fs.js:158)

Screenshot

sudo-prompt Error

Melvin-Abraham avatar Oct 02 '20 13:10 Melvin-Abraham