@wipcomputer/wip-ldm-os 0.4.9 → 0.4.11
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/SKILL.md +1 -1
- package/bin/ldm.js +7 -1
- package/package.json +1 -1
package/SKILL.md
CHANGED
package/bin/ldm.js
CHANGED
|
@@ -64,8 +64,13 @@ const LOCK_PATH = join(LDM_ROOT, 'state', '.ldm-install.lock');
|
|
|
64
64
|
|
|
65
65
|
function acquireInstallLock() {
|
|
66
66
|
try {
|
|
67
|
+
// Child processes spawned by `ldm install` inherit this env var
|
|
68
|
+
if (process.env.LDM_INSTALL_LOCK_PID) return true;
|
|
69
|
+
|
|
67
70
|
if (existsSync(LOCK_PATH)) {
|
|
68
71
|
const lock = JSON.parse(readFileSync(LOCK_PATH, 'utf8'));
|
|
72
|
+
// Re-entrant: if we already hold the lock, allow it
|
|
73
|
+
if (lock.pid === process.pid) return true;
|
|
69
74
|
// Check if PID is still alive
|
|
70
75
|
try {
|
|
71
76
|
process.kill(lock.pid, 0); // signal 0 = just check if alive
|
|
@@ -80,6 +85,7 @@ function acquireInstallLock() {
|
|
|
80
85
|
}
|
|
81
86
|
mkdirSync(dirname(LOCK_PATH), { recursive: true });
|
|
82
87
|
writeFileSync(LOCK_PATH, JSON.stringify({ pid: process.pid, started: new Date().toISOString() }));
|
|
88
|
+
process.env.LDM_INSTALL_LOCK_PID = String(process.pid);
|
|
83
89
|
|
|
84
90
|
// Clean up on exit
|
|
85
91
|
const cleanup = () => { try { if (existsSync(LOCK_PATH)) { const l = JSON.parse(readFileSync(LOCK_PATH, 'utf8')); if (l.pid === process.pid) unlinkSync(LOCK_PATH); } } catch {} };
|
|
@@ -597,7 +603,7 @@ function autoDetectExtensions() {
|
|
|
597
603
|
// ── ldm install (bare): scan system, show real state, update if needed ──
|
|
598
604
|
|
|
599
605
|
async function cmdInstallCatalog() {
|
|
600
|
-
|
|
606
|
+
// No lock here. cmdInstall() already holds it when calling this.
|
|
601
607
|
|
|
602
608
|
autoDetectExtensions();
|
|
603
609
|
|