@devcontainer-rs/cli 0.0.33 → 0.0.34
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/launcher.js +39 -13
- package/package.json +5 -2
package/launcher.js
CHANGED
|
@@ -4,6 +4,26 @@ const { execFileSync, spawn } = require("node:child_process");
|
|
|
4
4
|
|
|
5
5
|
const runtimeConfig = require("./runtime-config");
|
|
6
6
|
|
|
7
|
+
function outputText(value) {
|
|
8
|
+
if (!value) {
|
|
9
|
+
return "";
|
|
10
|
+
}
|
|
11
|
+
if (Buffer.isBuffer(value)) {
|
|
12
|
+
return value.toString("utf8");
|
|
13
|
+
}
|
|
14
|
+
return String(value);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function parseLibcOutput(output) {
|
|
18
|
+
if (/musl/i.test(output)) {
|
|
19
|
+
return "musl";
|
|
20
|
+
}
|
|
21
|
+
if (/glibc|gnu libc|gnu c library/i.test(output)) {
|
|
22
|
+
return "gnu";
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
7
27
|
function detectLibc(system = {}) {
|
|
8
28
|
if ((system.platform || process.platform) !== "linux") {
|
|
9
29
|
return null;
|
|
@@ -13,11 +33,12 @@ function detectLibc(system = {}) {
|
|
|
13
33
|
return system.libc;
|
|
14
34
|
}
|
|
15
35
|
|
|
16
|
-
|
|
17
|
-
|
|
36
|
+
const env = system.env || process.env;
|
|
37
|
+
if (env.DEVCONTAINER_RS_LIBC) {
|
|
38
|
+
return env.DEVCONTAINER_RS_LIBC;
|
|
18
39
|
}
|
|
19
40
|
|
|
20
|
-
const report = process.report;
|
|
41
|
+
const report = system.report || process.report;
|
|
21
42
|
if (report && typeof report.getReport === "function") {
|
|
22
43
|
const glibcVersion = report.getReport()?.header?.glibcVersionRuntime;
|
|
23
44
|
if (glibcVersion) {
|
|
@@ -25,31 +46,36 @@ function detectLibc(system = {}) {
|
|
|
25
46
|
}
|
|
26
47
|
}
|
|
27
48
|
|
|
49
|
+
const runCommand = system.execFileSync || execFileSync;
|
|
28
50
|
try {
|
|
29
|
-
const output =
|
|
51
|
+
const output = runCommand("getconf", ["GNU_LIBC_VERSION"], {
|
|
30
52
|
encoding: "utf8",
|
|
31
53
|
stdio: ["ignore", "pipe", "ignore"],
|
|
32
54
|
});
|
|
33
|
-
|
|
34
|
-
|
|
55
|
+
const libc = parseLibcOutput(output);
|
|
56
|
+
if (libc) {
|
|
57
|
+
return libc;
|
|
35
58
|
}
|
|
36
59
|
} catch (_error) {
|
|
37
60
|
// fall through to ldd parsing
|
|
38
61
|
}
|
|
39
62
|
|
|
40
63
|
try {
|
|
41
|
-
const output =
|
|
64
|
+
const output = runCommand("ldd", ["--version"], {
|
|
42
65
|
encoding: "utf8",
|
|
43
66
|
stdio: ["ignore", "pipe", "pipe"],
|
|
44
67
|
});
|
|
45
|
-
|
|
46
|
-
|
|
68
|
+
const libc = parseLibcOutput(output);
|
|
69
|
+
if (libc) {
|
|
70
|
+
return libc;
|
|
47
71
|
}
|
|
48
|
-
|
|
49
|
-
|
|
72
|
+
} catch (error) {
|
|
73
|
+
const libc = parseLibcOutput(
|
|
74
|
+
`${outputText(error.stdout)}\n${outputText(error.stderr)}`,
|
|
75
|
+
);
|
|
76
|
+
if (libc) {
|
|
77
|
+
return libc;
|
|
50
78
|
}
|
|
51
|
-
} catch (_error) {
|
|
52
|
-
// fall through to the default below
|
|
53
79
|
}
|
|
54
80
|
|
|
55
81
|
return "gnu";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devcontainer-rs/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.34",
|
|
4
4
|
"description": "Rust-native devcontainer CLI wrapper package for the upstream @devcontainers/cli shape",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -22,6 +22,9 @@
|
|
|
22
22
|
"runtime-config.js"
|
|
23
23
|
],
|
|
24
24
|
"optionalDependencies": {
|
|
25
|
-
"@devcontainer-rs/devcontainer-darwin-
|
|
25
|
+
"@devcontainer-rs/devcontainer-darwin-x64": "0.0.34",
|
|
26
|
+
"@devcontainer-rs/devcontainer-darwin-arm64": "0.0.34",
|
|
27
|
+
"@devcontainer-rs/devcontainer-linux-x64-gnu": "0.0.34",
|
|
28
|
+
"@devcontainer-rs/devcontainer-linux-x64-musl": "0.0.34"
|
|
26
29
|
}
|
|
27
30
|
}
|