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

@dotenvx/dotenvx

Package Overview
Dependencies
Maintainers
2
Versions
187
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dotenvx/dotenvx - npm Package Compare versions

Comparing version 0.6.13 to 0.7.1

3

package.json
{
"version": "0.6.13",
"version": "0.7.1",
"name": "@dotenvx/dotenvx",

@@ -29,2 +29,3 @@ "description": "a better dotenv–from the creator of `dotenv`",

"dotenv": "^16.3.1",
"execa": "^5.1.1",
"winston": "^3.11.0",

@@ -31,0 +32,0 @@ "xxhashjs": "^0.2.2"

@@ -61,3 +61,3 @@ #!/usr/bin/env node

.option('-o, --overload', 'override existing env variables')
.action(function () {
.action(async function () {
const options = this.opts()

@@ -171,3 +171,3 @@ logger.debug('configuring options')

helpers.executeCommand(subCommand, process.env)
await helpers.executeCommand(subCommand, process.env)
}

@@ -174,0 +174,0 @@ })

const fs = require('fs')
const path = require('path')
const execa = require('execa')
const crypto = require('crypto')
const { spawn } = require('child_process')
const xxhash = require('xxhashjs')

@@ -21,12 +21,29 @@

const executeCommand = function (subCommand, env) {
const subprocess = spawn(subCommand[0], subCommand.slice(1), {
stdio: 'inherit',
shell: true,
env: { ...process.env, ...env }
})
const executeCommand = async function (subCommand, env) {
// handler for SIGINT
let subprocess
const sigintHandler = () => {
if (subprocess) {
subprocess.kill('SIGINT') // Send SIGINT to the subprocess
}
}
subprocess.on('close', (code) => {
if (code > 0) {
logger.error(`command [${subCommand.join(' ')}] failed (code: ${code})`)
try {
const subprocess = execa(subCommand[0], subCommand.slice(1), {
stdio: 'inherit',
env: { ...process.env, ...env }
})
process.on('SIGINT', sigintHandler)
// Wait for the subprocess to finish
const { exitCode } = await subprocess
if (exitCode !== 0) {
throw new Error(`Command failed with exit code ${exitCode}`)
}
} catch (error) {
if (error.signal !== 'SIGINT') {
logger.error(error.message)
logger.error(`command [${subCommand.join(' ')}] failed`)
logger.error('')

@@ -39,16 +56,8 @@ logger.error(` try without dotenvx: [${subCommand.join(' ')}]`)

process.exit(code)
})
subprocess.on('error', (err) => {
logger.error(err)
logger.error(`command [${subCommand.join(' ')}] failed`)
logger.error('')
logger.error(` try without dotenvx: [${subCommand.join(' ')}]`)
logger.error('')
logger.error('if that succeeds, then dotenvx is the culprit. report issue:')
logger.error(`<${REPORT_ISSUE_LINK}>`)
process.exit(1)
})
// Exit with the error code from the subprocess, or 1 if unavailable
process.exit(error.exitCode || 1)
} finally {
// Clean up: Remove the SIGINT handler
process.removeListener('SIGINT', sigintHandler)
}
}

@@ -55,0 +64,0 @@

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