cicy-desktop 2.1.100 → 2.1.101
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/sidecar/docker.js +22 -1
package/package.json
CHANGED
package/src/sidecar/docker.js
CHANGED
|
@@ -28,9 +28,30 @@ const DOCKER_DESKTOP_MIRROR = process.env.CICY_DOCKER_DESKTOP_MIRROR
|
|
|
28
28
|
// CICY_* env vars forwarded into the container (team onboarding, version pin…).
|
|
29
29
|
const PASS_ENV = ["CICY_TEAM_TOKEN", "CICY_CODE_VERSION", "NPM_REGISTRY", "CICY_NPM_REGISTRY", "CICY_AGENTS", "ENABLE_CDN", "CICY_CLOUDFLARED_TOKEN"];
|
|
30
30
|
|
|
31
|
+
// Resolve the docker CLI. CRITICAL on Windows: right after Docker Desktop
|
|
32
|
+
// installs, it adds `...\Docker\resources\bin` to the SYSTEM PATH — but the
|
|
33
|
+
// ALREADY-RUNNING cicy-desktop process keeps its stale PATH, so a bare
|
|
34
|
+
// `execFile("docker", …)` ENOENTs and dockerOk() stays false forever (the
|
|
35
|
+
// "已安装但起不来 / 卡在正在启动" bug). Probe the known absolute install paths
|
|
36
|
+
// first; only fall back to PATH (and never cache that fallback, so a later
|
|
37
|
+
// install is picked up).
|
|
38
|
+
let _dockerBin = null;
|
|
39
|
+
function dockerBin() {
|
|
40
|
+
if (_dockerBin) return _dockerBin;
|
|
41
|
+
if (process.platform === "win32") {
|
|
42
|
+
const cands = [
|
|
43
|
+
path.join(process.env["ProgramFiles"] || "C:\\Program Files", "Docker", "Docker", "resources", "bin", "docker.exe"),
|
|
44
|
+
path.join(process.env["ProgramW6432"] || "", "Docker", "Docker", "resources", "bin", "docker.exe"),
|
|
45
|
+
path.join(process.env["LOCALAPPDATA"] || "", "Docker", "Docker", "resources", "bin", "docker.exe"),
|
|
46
|
+
].filter((c) => c && !c.startsWith("Docker"));
|
|
47
|
+
for (const c of cands) { try { if (fs.existsSync(c)) { _dockerBin = c; return c; } } catch {} }
|
|
48
|
+
}
|
|
49
|
+
return "docker"; // PATH fallback (mac/linux, or before Docker is installed)
|
|
50
|
+
}
|
|
51
|
+
|
|
31
52
|
function run(args, { timeout = 30000 } = {}) {
|
|
32
53
|
return new Promise((resolve, reject) => {
|
|
33
|
-
execFile(
|
|
54
|
+
execFile(dockerBin(), args, { timeout, windowsHide: true }, (err, stdout, stderr) => {
|
|
34
55
|
if (err) { err.stdout = String(stdout || ""); err.stderr = String(stderr || ""); return reject(err); }
|
|
35
56
|
resolve({ stdout: String(stdout), stderr: String(stderr) });
|
|
36
57
|
});
|