@quolu/lattice 0.68.2 → 0.68.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quolu/lattice",
3
- "version": "0.68.2",
3
+ "version": "0.68.3",
4
4
  "description": "Schedulability compiler for multi-agent development: observe real code boundaries, refactor the conflicting seam, recompile the plan for parallel execution",
5
5
  "author": {
6
6
  "name": "Quo / クオ at kitepon.dev",
@@ -285,9 +285,13 @@ async function stopRunning({ env, listen, runner, waitStopped }) {
285
285
  const pid = Number(pidText.trim());
286
286
  if (!Number.isSafeInteger(pid) || pid <= 0) return;
287
287
  const result = await runner(['taskkill.exe', '/T', '/F', '/PID', String(pid)]);
288
- // taskkill exits non-zero (128) when the target is already gone — not a failure to report.
289
- if (result.code !== 0 && !/not found|not running/iu.test(result.stderr ?? '')) {
290
- throw fail('BRIDGE_STARTUP_FOLDER_STOP_FAILED', 'could not stop bridge supervisor process tree');
288
+ // Windowsの表示言語に依存せず、既に終了したプロセスを判定する。
289
+ if (result.code !== 0) {
290
+ let absent = false;
291
+ try { process.kill(pid, 0); } catch (error) { absent = error?.code === 'ESRCH'; }
292
+ if (!absent) {
293
+ throw fail('BRIDGE_STARTUP_FOLDER_STOP_FAILED', 'could not stop bridge supervisor process tree');
294
+ }
291
295
  }
292
296
  await waitStopped({ listen, env });
293
297
  await rm(refs.pidfile, { force: true });
@@ -98,7 +98,7 @@ async function readJson(ref, missing) {
98
98
 
99
99
  async function atomicJson(ref, value) {
100
100
  const temporary = `${ref}.${process.pid}.${randomBytes(8).toString('hex')}.tmp`;
101
- await writeFile(temporary, `${JSON.stringify(value)}\n`, { encoding: 'utf8', mode: 0o600, flag: 'wx' });
101
+ await writeFile(temporary, `${JSON.stringify(value)}\n`, { encoding: 'utf8', mode: 0o600, flag: 'wx', flush: true });
102
102
  await rename(temporary, ref);
103
103
  }
104
104