@dotenvx/dotenvx 0.7.1 → 0.7.2
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 +1 -1
- package/src/cli/helpers.js +19 -0
package/package.json
CHANGED
package/src/cli/helpers.js
CHANGED
|
@@ -19,14 +19,28 @@ const resolvePath = function (filepath) {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
const executeCommand = async function (subCommand, env) {
|
|
22
|
+
const signals = [
|
|
23
|
+
'SIGHUP', 'SIGQUIT', 'SIGILL', 'SIGTRAP', 'SIGABRT',
|
|
24
|
+
'SIGBUS', 'SIGFPE', 'SIGUSR1', 'SIGSEGV', 'SIGUSR2', 'SIGTERM'
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
logger.debug(`executing subcommand ${subCommand}`)
|
|
28
|
+
|
|
22
29
|
// handler for SIGINT
|
|
23
30
|
let subprocess
|
|
24
31
|
const sigintHandler = () => {
|
|
32
|
+
logger.debug('received SIGINT')
|
|
33
|
+
|
|
25
34
|
if (subprocess) {
|
|
35
|
+
logger.debug('sending SIGINT to subprocess')
|
|
26
36
|
subprocess.kill('SIGINT') // Send SIGINT to the subprocess
|
|
27
37
|
}
|
|
28
38
|
}
|
|
29
39
|
|
|
40
|
+
const handleOtherSignal = (signal) => {
|
|
41
|
+
logger.debug(`received ${signal}`)
|
|
42
|
+
}
|
|
43
|
+
|
|
30
44
|
try {
|
|
31
45
|
const subprocess = execa(subCommand[0], subCommand.slice(1), {
|
|
32
46
|
stdio: 'inherit',
|
|
@@ -35,10 +49,15 @@ const executeCommand = async function (subCommand, env) {
|
|
|
35
49
|
|
|
36
50
|
process.on('SIGINT', sigintHandler)
|
|
37
51
|
|
|
52
|
+
signals.forEach(signal => {
|
|
53
|
+
process.on(signal, () => handleOtherSignal(signal))
|
|
54
|
+
})
|
|
55
|
+
|
|
38
56
|
// Wait for the subprocess to finish
|
|
39
57
|
const { exitCode } = await subprocess
|
|
40
58
|
|
|
41
59
|
if (exitCode !== 0) {
|
|
60
|
+
logger.debug(`received exitCode ${exitCode}`)
|
|
42
61
|
throw new Error(`Command failed with exit code ${exitCode}`)
|
|
43
62
|
}
|
|
44
63
|
} catch (error) {
|