triflux 4.2.7 → 4.2.8
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/hub/server.mjs +6 -1
- package/package.json +1 -1
- package/scripts/preinstall.mjs +6 -0
package/hub/server.mjs
CHANGED
|
@@ -259,7 +259,12 @@ function servePublicFile(res, path) {
|
|
|
259
259
|
*/
|
|
260
260
|
export async function startHub({ port = 27888, dbPath, host = '127.0.0.1', sessionId = process.pid } = {}) {
|
|
261
261
|
if (!dbPath) {
|
|
262
|
-
|
|
262
|
+
// DB를 npm 패키지 밖에 저장하여 npm update 시 EBUSY 방지
|
|
263
|
+
// 기존: PROJECT_ROOT/.tfx/state/state.db (패키지 내부 → 락 충돌)
|
|
264
|
+
// 변경: ~/.claude/cache/tfx-hub/state.db (패키지 외부 → 안전)
|
|
265
|
+
const hubCacheDir = join(homedir(), '.claude', 'cache', 'tfx-hub');
|
|
266
|
+
mkdirSync(hubCacheDir, { recursive: true });
|
|
267
|
+
dbPath = join(hubCacheDir, 'state.db');
|
|
263
268
|
}
|
|
264
269
|
|
|
265
270
|
mkdirSync(PUBLIC_DIR, { recursive: true });
|
package/package.json
CHANGED
package/scripts/preinstall.mjs
CHANGED
|
@@ -23,6 +23,12 @@ function stopHub() {
|
|
|
23
23
|
process.kill(pid, "SIGTERM");
|
|
24
24
|
console.log(`[triflux preinstall] Hub 중지됨 (PID ${pid}) — EBUSY 방지`);
|
|
25
25
|
|
|
26
|
+
// Windows: 프로세스 종료 + 파일 핸들 해제 대기 (최대 3초)
|
|
27
|
+
const start = Date.now();
|
|
28
|
+
while (Date.now() - start < 3000) {
|
|
29
|
+
try { process.kill(pid, 0); } catch { break; }
|
|
30
|
+
}
|
|
31
|
+
|
|
26
32
|
// PID 파일 정리
|
|
27
33
|
try { unlinkSync(HUB_PID_FILE); } catch {}
|
|
28
34
|
} catch (err) {
|