(options, config)
| 4 | var renderer; |
| 5 | |
| 6 | function rootCheck(options, config) { |
| 7 | var errorMsg; |
| 8 | |
| 9 | // Allow running the command as root |
| 10 | if (options.allowRoot || config.allowRoot) { |
| 11 | return; |
| 12 | } |
| 13 | |
| 14 | errorMsg = |
| 15 | 'Since bower is a user command, there is no need to execute it with \ |
| 16 | superuser permissions.\nIf you\'re having permission errors when using bower without \ |
| 17 | sudo, please spend a few minutes learning more about how your system should work and \ |
| 18 | make any necessary repairs.\n\n\ |
| 19 | http://www.joyent.com/blog/installing-node-and-npm\n\ |
| 20 | https://gist.github.com/isaacs/579814\n\n\ |
| 21 | You can however run a command with sudo using "--allow-root" option'; |
| 22 | |
| 23 | if (isRoot()) { |
| 24 | var cli = require('./cli'); |
| 25 | renderer = cli.getRenderer('', false, config); |
| 26 | renderer.error( |
| 27 | createError('Please do not run with sudo', 'ESUDO', { |
| 28 | details: errorMsg |
| 29 | }) |
| 30 | ); |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | module.exports = rootCheck; |
no test coverage detected
searching dependent graphs…