Throw error when not run as root
Is this even possible?
i guess with these it might be possible:
console.log process.getuid() # user id (0 for root)
console.log process.getgid() # group id (0 for root)
Why does this module require root? Only thing it seems to be doing is running ps -A -o pid,rss,vsz,pcpu,comm and parsing it? I noticed that command works on both OS X and XUbuntu. Also the example script works, when non root and no sudo.
Does only some distros require root for this? Not sure if throwing a error is a good idea if it works on the platform. Really curious on why, as I haven't ran into any issues being non root yet. Plus I know generally it's not recommended to run things as root on servers.
@keverw It's definitely needed for Windows users, I'm not entirely sure for unix/linux/osx.
@branneman Interesting. I noticed some other modules use ps and didn't mention the need of root. So maybe just a Windows thing then.
I just hope if you implement throwing a error that it would check if it would run and then only throw if permissions related. So just try the PS command or Windows API first then have a error if it can't function without permissions.
Otherwise this is a great module :)