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

exec-sync

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exec-sync - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

27

bin/index.js
(function() {
var FFI, fs, libc, uniqId, uniqIdK;
var FFI, fs, libc, tmpDir, uniqId, uniqIdK;

@@ -19,9 +19,26 @@ FFI = require("node-ffi");

tmpDir = function() {
var dir, name, _i, _len, _ref;
_ref = ['TMPDIR', 'TMP', 'TEMP'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
name = _ref[_i];
if (process.env[name] != null) {
dir = process.env[name];
if (dir.charAt(dir.length - 1) === '/') {
return dir.substr(0, dir.length - 1);
}
return dir;
}
}
return '/tmp';
};
module.exports = function(cmd) {
var result, tmp;
var dir, result, tmp;
tmp = uniqId() + '.tmp';
cmd = "" + cmd + " > " + __dirname + "/" + tmp;
dir = tmpDir();
cmd = "" + cmd + " > " + dir + "/" + tmp;
libc.system(cmd);
result = fs.readFileSync("" + __dirname + "/" + tmp);
fs.unlinkSync("" + __dirname + "/" + tmp);
result = fs.readFileSync("" + dir + "/" + tmp);
fs.unlinkSync("" + dir + "/" + tmp);
result = "" + result;

@@ -28,0 +45,0 @@ if (result.charAt(result.length - 1) === "\n") {

2

package.json
{
"name": "exec-sync",
"version": "0.1.0",
"version": "0.1.1",
"description": "Execute shell command synchronously. Use this for migration scripts, cli programs, but not for regular server code.",

@@ -5,0 +5,0 @@ "keywords": [

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