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

@electron-lab/utils

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@electron-lab/utils - npm Package Compare versions

Comparing version 0.1.3-alpha.0 to 0.1.3-alpha.1

27

lib/exec.js

@@ -12,10 +12,9 @@ "use strict";

var _path = require("path");
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function execWithPaths(command, ...rest) {
if (process.platform !== 'darwin') {
throw new Error(`ExecWithPaths works in MacOS only.`);
}
const cmd = command.split(' ')[0];
let options = rest[0],

@@ -29,12 +28,10 @@ callback = rest[1];

const paths = (0, _fs.readFileSync)('/etc/paths', {
const PATH = (0, _fs.readFileSync)('/etc/paths', {
encoding: 'utf-8'
});
const bin = paths.trim().split('\n').map(p => (0, _path.join)(p.trim(), cmd)).filter(binPath => (0, _fs.existsSync)(binPath))[0];
if (bin) {
return (0, _child_process.exec)([bin].concat(command.split(' ').slice(1)).join(' '), options, callback);
} else {
throw new Error(`Command ${cmd} notFound`);
}
}).trim().split('\n').map(path => path.trim()).join(':');
return (0, _child_process.exec)(command, _objectSpread(_objectSpread({}, options), {}, {
env: _objectSpread(_objectSpread(_objectSpread({}, process.env), options.env), {}, {
PATH: Array.from(new Set([PATH, options.env.PATH, process.env.PATH].filter(Boolean).map(_ => _.trim()).join(':').split(':'))).join(':')
})
}), callback);
}

@@ -41,0 +38,0 @@

{
"name": "@electron-lab/utils",
"version": "0.1.3-alpha.0",
"version": "0.1.3-alpha.1",
"description": "A collection of electron development tools",

@@ -43,3 +43,3 @@ "keywords": [

},
"gitHead": "54924674159f737ac085445261f42c8297b381c1"
"gitHead": "60fb0b740301b3a712c06e43552d2f24c7ee64c1"
}
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