Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

native-is-elevated

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

native-is-elevated - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

12

index.js
'use strict';
var isElevatedModule = null;
var isElevated = null;
var tried = false;

@@ -9,3 +9,3 @@

try {
isElevatedModule = require('./build/Release/is-elevated');
isElevated = require('./build/Release/is-elevated');
} catch (err) {

@@ -16,9 +16,9 @@ console.error(err);

if (!isElevatedModule) {
if (!isElevated) {
return false;
}
var r = false;
var retValue = false;
try {
r = isElevatedModule.isElevated();
retValue = isElevated.isElevated();
} catch (err) {

@@ -28,3 +28,3 @@ console.error(err);

return r;
return retValue;
};
{
"name": "native-is-elevated",
"version": "0.1.0",
"description": "Native Node module for checking if the process is being run with elevated privileges",
"version": "0.1.1",
"description": "Native module for checking if the process is being run with elevated privileges",
"main": "index.js",
"scripts": {
"configure": "node-gyp configure",
"build": "node-gyp build",

@@ -8,0 +9,0 @@ "test": "ava"

var test = require('ava').serial;
var isElevated = require('.');
// Note that 1 of the 2 tests will fail depending on if you're running
// it normally, or with root/admin rights
test('normal', t => {
t.false(isElevated());
t.false(isElevated());
});
test('elevated', t => {
if (process.platform === 'win32') {
// TODO
} else {
const _ = process.getuid;
process.getuid = () => 0;
t.true(isElevated());
process.getuid = _;
}
t.true(isElevated());
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc