@hmharness/domain-harmony 0.13.1 → 0.13.2

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.
Files changed (2) hide show
  1. package/dist/emulator.js +20 -1
  2. package/package.json +1 -1
package/dist/emulator.js CHANGED
@@ -192,7 +192,26 @@ export const harmonyEmulatorStop = {
192
192
  /* already gone */
193
193
  }
194
194
  }
195
- return { output: `stopped: ${targets.map((t) => `${t.hvd} (pid ${t.pid})`).join(', ')}` };
195
+ // verify, never trust the kill report (day-19 SELFFEED: taskkill returned
196
+ // success while Emulator.exe was still alive for seconds) - poll until the
197
+ // CIM query no longer sees the target pids, bounded at ~15s
198
+ const wantGone = new Set(targets.map((t) => t.pid));
199
+ let stillAlive = [];
200
+ for (let waited = 0; waited <= 15_000; waited += 2000) {
201
+ await new Promise((res) => setTimeout(res, waited === 0 ? 1000 : 2000));
202
+ const now = await runningEmulators();
203
+ stillAlive = now.map((r) => r.pid).filter((pid) => wantGone.has(pid));
204
+ if (stillAlive.length === 0)
205
+ break;
206
+ }
207
+ const stopped = targets.filter((t) => !stillAlive.includes(t.pid));
208
+ const stuck = targets.filter((t) => stillAlive.includes(t.pid));
209
+ const lines = [];
210
+ if (stopped.length > 0)
211
+ lines.push(`stopped: ${stopped.map((t) => `${t.hvd} (pid ${t.pid})`).join(', ')} (verified gone)`);
212
+ if (stuck.length > 0)
213
+ lines.push(`NOT stopped (process still alive after taskkill - kill it manually or retry): ${stuck.map((t) => `${t.hvd} (pid ${t.pid})`).join(', ')}`);
214
+ return { output: lines.join('\n'), ...(stuck.length > 0 ? { isError: true } : {}) };
196
215
  },
197
216
  };
198
217
  export const harmonyEmulatorCatalog = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/domain-harmony",
3
- "version": "0.13.1",
3
+ "version": "0.13.2",
4
4
  "description": "hmharness HarmonyOS domain core: device, toolchain, build, and project lifecycle capabilities. HarmonyOS is the framework's native domain, not an add-on.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",