Good morning everyone. I am still working on my new package manager for Linux. In some case, I need to check if my command line program was run with privilege or not. How can I do that ?
if LibC.getuid == 0
puts "superuser"
else
puts "not superuser"
end
1 Like
Thank you !
I have another question about that. If my program try to access to a file it don’t have the proper right, how can I know that ?
Depends on your exact use-case but probably one of these:
1 Like
An exception is thrown. Just rescue it.
1 Like
Why I didn’t think about that earlier