How to use the errno.EPERM function in errno

To help you get started, we’ve selected a few errno examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github saghul / sjs / test / test-process-spawn-setuid.js View on Github external
var info = pwd.getpwnam('nobody');
if (info === null) {
    console.log('SKIP: there is no "nobody" user');
    os.exit(0);
}

var p;
var r;

try {
    p = proc.spawn(['ls', '-l'],
                   {cwd: '/', uid: info.uid, gid: info.gid});
} catch (e) {
    assert.equal(e.errno, errno.EPERM);
    console.log('SKIP: no permission to downgrade to user "nobody"');
    os.exit(0);
}
r = p.wait();
assert.equal(r.exit_status, 0);
assert.equal(r.term_signal, 0);

errno

libuv errno details exposed

MIT
Latest version published 4 years ago

Package Health Score

74 / 100
Full package analysis