@lenso/cli 0.2.9 → 0.2.13
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/bin/lenso.js +22 -1
- package/package.json +2 -1
- package/vendor/darwin-arm64/lenso +0 -0
- package/vendor/darwin-x64/lenso +0 -0
- package/vendor/linux-x64/lenso +0 -0
- package/vendor/win32-x64/lenso.exe +0 -0
package/bin/lenso.js
CHANGED
|
@@ -22,6 +22,25 @@ function binaryPath(baseDir = path.join(__dirname, '..'), platform = process.pla
|
|
|
22
22
|
return path.join(baseDir, 'vendor', tag, exe);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
function forwardTerminationSignals(parent, child, signals = ['SIGINT', 'SIGTERM']) {
|
|
26
|
+
const handlers = new Map(signals.map((signal) => [
|
|
27
|
+
signal,
|
|
28
|
+
() => {
|
|
29
|
+
if (child.exitCode === null && child.signalCode === null) {
|
|
30
|
+
child.kill(signal);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
]));
|
|
34
|
+
for (const [signal, handler] of handlers) {
|
|
35
|
+
parent.on(signal, handler);
|
|
36
|
+
}
|
|
37
|
+
return () => {
|
|
38
|
+
for (const [signal, handler] of handlers) {
|
|
39
|
+
parent.off(signal, handler);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
25
44
|
function run() {
|
|
26
45
|
const exe = binaryPath();
|
|
27
46
|
if (!exe) {
|
|
@@ -30,6 +49,7 @@ function run() {
|
|
|
30
49
|
}
|
|
31
50
|
|
|
32
51
|
const child = spawn(exe, process.argv.slice(2), { stdio: 'inherit' });
|
|
52
|
+
const stopForwardingSignals = forwardTerminationSignals(process, child);
|
|
33
53
|
child.on('error', (error) => {
|
|
34
54
|
if (error.code === 'ENOENT') {
|
|
35
55
|
console.error(`lenso: bundled binary is missing for ${process.platform}/${process.arch}`);
|
|
@@ -39,6 +59,7 @@ function run() {
|
|
|
39
59
|
process.exit(1);
|
|
40
60
|
});
|
|
41
61
|
child.on('exit', (code, signal) => {
|
|
62
|
+
stopForwardingSignals();
|
|
42
63
|
if (signal) {
|
|
43
64
|
process.kill(process.pid, signal);
|
|
44
65
|
return;
|
|
@@ -51,4 +72,4 @@ if (require.main === module) {
|
|
|
51
72
|
run();
|
|
52
73
|
}
|
|
53
74
|
|
|
54
|
-
module.exports = { binaryPath, platformTag };
|
|
75
|
+
module.exports = { binaryPath, forwardTerminationSignals, platformTag };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenso/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"description": "Lenso command-line interface for scaffolding and operating Lenso backend projects.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/LioRael/lenso-cli",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"scripts": {
|
|
19
19
|
"check:npm-publish": "node scripts/check-npm-publish.mjs",
|
|
20
|
+
"check:reviewed-publisher": "node scripts/check-reviewed-publisher.mjs",
|
|
20
21
|
"check:npm-shim": "node scripts/check-npm-shim.mjs",
|
|
21
22
|
"check:release-versions": "node scripts/check-release-versions.mjs",
|
|
22
23
|
"install:hosted-console": "node scripts/install-hosted-console.mjs",
|
|
Binary file
|
package/vendor/darwin-x64/lenso
CHANGED
|
Binary file
|
package/vendor/linux-x64/lenso
CHANGED
|
Binary file
|
|
Binary file
|