开发者

Execute a command as sudo from within a rake task?

开发者 https://www.devze.com 2023-03-13 22:16 出处:网络
Other than hard-coding \"sudo\" into the exec/system argument string, is there a flag in Rake that specifies that a command needs to be executed with root privileges, and will prompt for a password if

Other than hard-coding "sudo" into the exec/system argument string, is there a flag in Rake that specifies that a command needs to be executed with root privileges, and will prompt for a password if needed? Like how Babushka has a :sudo => true开发者_如何转开发 option.


don't know if there's a Rake option for this (but I suppose there isn't). you can easyly do it by checking user's privileges. check this answer:

On Unix, find if user who executed the program is root?

0

精彩评论

暂无评论...
验证码 换一张
取 消