@dotenvx/dotenvx 1.65.0 → 1.65.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.65.0",
2
+ "version": "1.65.1",
3
3
  "name": "@dotenvx/dotenvx",
4
4
  "description": "secrets for agents–from the creator of `dotenv`",
5
5
  "author": "@motdotla",
@@ -42,7 +42,7 @@ class Ops {
42
42
  if (publicKey) args.push(publicKey)
43
43
 
44
44
  try {
45
- return JSON.parse(await this._exec(binary, args))
45
+ return JSON.parse(await this._execInteractive(binary, args))
46
46
  } catch (_e) {
47
47
  return {}
48
48
  }
@@ -58,7 +58,7 @@ class Ops {
58
58
  if (publicKey) args.push(publicKey)
59
59
 
60
60
  try {
61
- return JSON.parse(this._execSync(binary, args))
61
+ return JSON.parse(this._execInteractiveSync(binary, args))
62
62
  } catch (_e) {
63
63
  return {}
64
64
  }
@@ -104,6 +104,36 @@ class Ops {
104
104
  return childProcess.execFileSync(binary, args).toString().trim()
105
105
  }
106
106
 
107
+ _execInteractive (binary, args) {
108
+ return new Promise((resolve, reject) => {
109
+ const subprocess = childProcess.spawn(binary, args, {
110
+ stdio: ['inherit', 'pipe', 'inherit']
111
+ })
112
+ let stdout = ''
113
+
114
+ subprocess.stdout.on('data', (data) => {
115
+ stdout += data.toString()
116
+ })
117
+ subprocess.on('error', reject)
118
+ subprocess.on('close', (code) => {
119
+ if (code !== 0) {
120
+ reject(new Error(`${binary} ${args.join(' ')} exited with code ${code}`))
121
+ return
122
+ }
123
+
124
+ resolve(stdout.trim())
125
+ })
126
+ })
127
+ }
128
+
129
+ _execInteractiveSync (binary, args) {
130
+ logger.debug(binary)
131
+ logger.debug(args)
132
+ return childProcess.execFileSync(binary, args, {
133
+ stdio: ['inherit', 'pipe', 'inherit']
134
+ }).toString().trim()
135
+ }
136
+
107
137
  async _resolveBinary () {
108
138
  if (this._binaryPromise) return this._binaryPromise
109
139