how can I take user permission once and use it throughout the electron app?

75
February 12, 2019, at 11:50 PM

I am creating an electron app where I need to scan and update files which need root permission. I know I can run such commands using sudo.exec() in that way:

sudo.exec ("rm /private/var/log/fsck_hfs.log", options, (e, stdout, stderr) => {});

And even I can put multiple commands in a script and execute them with single sudo.exec(). In my case, commands needs to be executed at different point of time and I cannot execute them with a single script. It is annoying for user to grant permissions again and again.

I tried to do it another way (to run a piece of code where everything that require root permission can be executed). For that, I posted another question here. But it seems that it is not possible.

Now I want a way to get permission to change and update files once when use install app (as most of the apps does after user install them) and can be able to use sudo.exec() or some other method to execute commands (preferably also the code fs.readdir, etc) that require root permission.

READ ALSO
Browser accepts “classic” js script-tag, but not ES6 modules — MIME error w/ Node http server

Browser accepts “classic” js script-tag, but not ES6 modules — MIME error w/ Node http server

I want to play with ES6 modules, so I decided on using Node as a simple web server to avoid all CORS related errors I first encountered when doing it locallyNow I get MIME type related errors in the browser which I can't quite grasp

96
create a Dynamic mapping for parsing multiple input files to an obj in kotlin

create a Dynamic mapping for parsing multiple input files to an obj in kotlin

Let's say I have a json data that can have different Key names for the same data field

64