开发者

Execute a command as sudo from within a rake task?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜