devlanes 0.2.0 → 0.4.0

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/devlanes.js DELETED
@@ -1,44 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
-
4
- // Runs the native binary from the @devlanes/<platform>-<arch> package that npm
5
- // installed as an optional dependency.
6
- const { spawn } = require("node:child_process");
7
- const path = require("node:path");
8
-
9
- const platform = `${process.platform}-${process.arch}`;
10
- let binary;
11
- try {
12
- const manifest = require.resolve(`@devlanes/${platform}/package.json`);
13
- binary = path.join(path.dirname(manifest), "bin", "devlanes");
14
- } catch {
15
- console.error(
16
- `devlanes: no binary installed for ${platform}. Release builds exist for ` +
17
- "darwin-arm64, darwin-x64, linux-arm64 and linux-x64 (glibc).\n" +
18
- "If npm ran with --omit=optional or --no-optional, reinstall without it.",
19
- );
20
- process.exit(1);
21
- }
22
-
23
- const child = spawn(binary, process.argv.slice(2), { stdio: "inherit" });
24
-
25
- // The terminal already delivers SIGINT and SIGQUIT to the whole process group,
26
- // so forwarding them would reach the binary twice. Signals sent only to this
27
- // wrapper are passed on.
28
- for (const signal of ["SIGINT", "SIGQUIT"]) process.on(signal, () => {});
29
- for (const signal of ["SIGTERM", "SIGHUP"]) {
30
- process.on(signal, () => child.kill(signal));
31
- }
32
-
33
- child.on("error", (error) => {
34
- console.error(`devlanes: cannot run ${binary}: ${error.message}`);
35
- process.exit(1);
36
- });
37
- child.on("exit", (code, signal) => {
38
- if (signal) {
39
- process.removeAllListeners(signal);
40
- process.kill(process.pid, signal);
41
- return;
42
- }
43
- process.exit(code ?? 1);
44
- });