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

foreground-child

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

foreground-child - npm Package Compare versions

Comparing version 1.5.1 to 1.5.2

CHANGELOG.md

37

index.js
var signalExit = require('signal-exit')
var spawn = require('child_process').spawn
var crossSpawn = require('cross-spawn-async')
var fs = require('fs')
var which = require('which')
function needsCrossSpawn (exe) {
if (process.platform !== 'win32') {
return false
}
try {
exe = which.sync(exe)
} catch (er) {
// failure to find the file? cmd probably needed.
return true
}
if (/\.(com|cmd|bat)$/i.test(exe)) {
// need cmd.exe to run command and batch files
return true
}
var buffer = new Buffer(150)
try {
var fd = fs.openSync(exe, 'r')
fs.readSync(fd, buffer, 0, 150, 0)
} catch (e) {
// If it's not an actual file, probably it needs cmd.exe.
// also, would be unsafe to test arbitrary memory on next line!
return true
}
return /\#\!(.+)/i.test(buffer.toString().trim())
if (process.platform === 'win32') {
spawn = require('cross-spawn')
}

@@ -69,4 +39,3 @@

var spawnfn = needsCrossSpawn(program) ? crossSpawn : spawn
var child = spawnfn(program, args, spawnOpts)
var child = spawn(program, args, spawnOpts)

@@ -73,0 +42,0 @@ var childExited = false

{
"name": "foreground-child",
"version": "1.5.1",
"version": "1.5.2",
"description": "Run a child as if it's the foreground process. Give it stdio. Exit when it exits.",

@@ -10,5 +10,4 @@ "main": "index.js",

"dependencies": {
"cross-spawn-async": "^2.1.1",
"signal-exit": "^2.0.0",
"which": "^1.2.1"
"cross-spawn": "^4",
"signal-exit": "^2.0.0"
},

@@ -19,3 +18,5 @@ "devDependencies": {

"scripts": {
"test": "tap --coverage test/*.js"
"test": "tap --coverage test/*.js",
"changelog": "bash changelog.sh",
"postversion": "npm run changelog && git add CHANGELOG.md && git commit -m 'update changelog - '${npm_package_version}"
},

@@ -22,0 +23,0 @@ "repository": {

@@ -6,2 +6,3 @@ var fg = require('../index.js')

if (process.argv[2] === 'child') {
setTimeout(function(){}, 1000);
console.log('stdout')

@@ -8,0 +9,0 @@ setTimeout(function () {}, 1000)

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