Sha256: 4c3cc2ef373a7adbb980ad6be5190ede2b41c241798df0574dca61e57cafac91

Contents?: true

Size: 1022 Bytes

Versions: 7

Compression:

Stored size: 1022 Bytes

Contents

/*jshint multistr:true*/
'use strict';
var isRoot = require('is-root');
var createError = require('./createError');
var cli = require('./cli');

var renderer;

function rootCheck(options, config) {
    var errorMsg;

    // Allow running the command as root
    if (options.allowRoot || config.allowRoot) {
        return;
    }

    errorMsg = 'Since bower is a user command, there is no need to execute it with \
superuser permissions.\nIf you\'re having permission errors when using bower without \
sudo, please spend a few minutes learning more about how your system should work and \
make any necessary repairs.\n\n\
http://www.joyent.com/blog/installing-node-and-npm\n\
https://gist.github.com/isaacs/579814\n\n\
You can however run a command with sudo using --allow-root option';

    if (isRoot()) {
        renderer = cli.getRenderer('', false, config);
        renderer.error(createError('Cannot be run with sudo', 'ESUDO', { details : errorMsg }));
        process.exit(1);
    }
}

module.exports = rootCheck;

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
entangled-0.0.16 spec/dummy/public/node_modules/bower/lib/util/rootCheck.js
entangled-0.0.15 spec/dummy/public/node_modules/bower/lib/util/rootCheck.js
entangled-0.0.14 spec/dummy/public/node_modules/bower/lib/util/rootCheck.js
entangled-0.0.13 spec/dummy/public/node_modules/bower/lib/util/rootCheck.js
entangled-0.0.12 spec/dummy/public/node_modules/bower/lib/util/rootCheck.js
entangled-0.0.11 spec/dummy/public/node_modules/bower/lib/util/rootCheck.js
entangled-0.0.10 spec/dummy/public/node_modules/bower/lib/util/rootCheck.js