Skip to content

Commit 122bb4a

Browse files
committed
fix(harmonyos): answer the exec-wrap guard on the uninstall error paths
1 parent af65aaa commit 122bb4a

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • packages/platform-harmonyos/src/deployment

‎packages/platform-harmonyos/src/deployment/runtime.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ async function uninstallHarmonyApp(
8181
// hdc reports an unreachable target through stdout while still exiting zero, so an
8282
// absent bundle record is benign only when the shell transport itself proves alive.
8383
if (dump.exitCode === null || !(await isHarmonyShellTransportAlive(commands, device, signal))) {
84+
// exec-guard-allow: reachable at exit 0 — hdc reports unreachable targets through
85+
// stdout at exit zero, so processExitError would never fire; trio is probe context.
8486
throw new AppError('COMMAND_FAILED', `Could not probe the installed state of ${bundleId}`, {
8587
exitCode: dump.exitCode,
8688
stdout: dump.stdout,
@@ -102,6 +104,9 @@ async function uninstallHarmonyApp(
102104
if (parseBundleDump(after.stdout)) {
103105
// bm prints its verdict into stdout at exit code 0, so only a second dump that no
104106
// longer finds the record proves the removal.
107+
// exec-guard-allow: reachable at exit 0 — bm reports the removal verdict in stdout
108+
// at exit 0, so the trio here documents bm's own answer rather than an exec failure;
109+
// stderr enrichment would only repeat the line the message already quotes.
105110
throw new AppError('COMMAND_FAILED', `${bundleId} is still installed after bm uninstall`, {
106111
exitCode: uninstall.exitCode,
107112
stdout: uninstall.stdout,
@@ -110,6 +115,8 @@ async function uninstallHarmonyApp(
110115
});
111116
}
112117
if (after.exitCode === null || !(await isHarmonyShellTransportAlive(commands, device, signal))) {
118+
// exec-guard-allow: reachable at exit 0 — a failed post-uninstall dump still exits
119+
// zero through hdc, so processExitError would never fire; trio is probe context.
113120
throw new AppError('COMMAND_FAILED', `Could not verify the uninstall of ${bundleId}`, {
114121
exitCode: after.exitCode,
115122
stdout: after.stdout,

0 commit comments

Comments
 (0)