@bobfrankston/rmfmail 1.2.204 → 1.2.206

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/bin/mailx.js CHANGED
@@ -609,6 +609,20 @@ if (!isDaemon && !__isCommandInvocation && !__keepOthers) {
609
609
  clearInstanceFile();
610
610
  }
611
611
  }
612
+ // Get the daemon's cwd OFF the npm install directory. Launchers routinely
613
+ // start us with cwd = .../npm/node_modules/@bobfrankston/rmfmail/bin (rmfshare
614
+ // set it explicitly; a terminal `cd` there does it too), and every child we
615
+ // spawn — including the per-app msger launcher exe that lives for the whole
616
+ // session — inherits it. On Windows a process's cwd holds the directory
617
+ // locked, so `npm install -g` (the in-app self-update AND a manual update)
618
+ // dies with EBUSY renaming .../rmfmail/bin for as long as we run
619
+ // (Bob 2026-07-30: maroon "Update failed" banner, stuck on 1.2.202).
620
+ // All CLI file-path arguments were consumed by the command blocks above,
621
+ // so nothing downstream depends on the original cwd.
622
+ try {
623
+ process.chdir(process.env.USERPROFILE || process.env.HOME || "/");
624
+ }
625
+ catch { /* */ }
612
626
  // Auto-detach: re-spawn as background process so terminal returns immediately
613
627
  // Skip for: --verbose (want console), --daemon (already detached),
614
628
  // and any command flags (setup, kill, test, etc.)
@@ -2688,7 +2702,10 @@ RFC 5322 with CRLF line endings. Bodies are quoted-printable encoded (readable i
2688
2702
  try {
2689
2703
  const { execSync, spawn: spawnChild } = await import("child_process");
2690
2704
  console.log(" [update] Installing latest version...");
2691
- execSync("npm install -g @bobfrankston/rmfmail", { encoding: "utf-8", timeout: 120_000, stdio: "inherit", windowsHide: true });
2705
+ // stdio pipe (not inherit) so a failure's stderr lands in the
2706
+ // thrown error — "Command failed: npm install" with no reason
2707
+ // cost a three-round diagnosis of the EBUSY cwd-lock bug.
2708
+ execSync("npm install -g @bobfrankston/rmfmail", { encoding: "utf-8", timeout: 120_000, stdio: "pipe", windowsHide: true });
2692
2709
  console.log(" [update] Install complete — relaunching");
2693
2710
  // Spawn the new version detached so it outlives this process
2694
2711
  const child = spawnChild("rmfmail", [], { detached: true, stdio: "ignore", shell: true, windowsHide: true });
@@ -2701,7 +2718,8 @@ RFC 5322 with CRLF line endings. Bodies are quoted-printable encoded (readable i
2701
2718
  // shouldn't kill the running app. Surface the failure so the
2702
2719
  // banner can offer a retry instead of leaving "Updating..."
2703
2720
  // pinned forever.
2704
- const msg = e?.message || String(e);
2721
+ const stderrTail = (e?.stderr ? String(e.stderr) : "").trim().split(/\r?\n/).filter((l) => /error/i.test(l)).slice(0, 4).join(" | ");
2722
+ const msg = `${e?.message || String(e)}${stderrTail ? ` — ${stderrTail}` : ""}`;
2705
2723
  console.error(` [update] Install failed: ${msg}`);
2706
2724
  const offline = /ENOTFOUND|ECONNREFUSED|EAI_AGAIN|ETIMEDOUT|getaddrinfo|network|registry/i.test(msg);
2707
2725
  handle.send({ _event: "updateFailed", type: "updateFailed", offline, message: msg });
@@ -2801,6 +2819,10 @@ RFC 5322 with CRLF line endings. Bodies are quoted-printable encoded (readable i
2801
2819
  // and emits this when Word writes; compose.ts listens and reloads Quill.
2802
2820
  imapManager.on("wordEditUpdated", (payload) => {
2803
2821
  handle.send({ _event: "wordEditUpdated", type: "wordEditUpdated", ...payload });
2822
+ // Bring compose back to the front after a Word save — the service's
2823
+ // old mailx-host focusMainWindow call was a silent no-op (the helper
2824
+ // never existed); this native msger command is the real mechanism.
2825
+ handle.send({ _msgerWindow: "focus" });
2804
2826
  });
2805
2827
  // Cloud-write/read failures from mailx-settings → push to UI as a banner so
2806
2828
  // silent fall-back-to-local can no longer swallow Drive errors.
@@ -2888,6 +2910,11 @@ RFC 5322 with CRLF line endings. Bodies are quoted-printable encoded (readable i
2888
2910
  handle.send({ _event: "openMailto", type: "openMailto",
2889
2911
  to: data.to, cc: data.cc, bcc: data.bcc,
2890
2912
  subject: data.subject, body: data.body, inReplyTo: data.inReplyTo });
2913
+ // The user just clicked a mailto link in ANOTHER app —
2914
+ // bring our window to the front so the compose is visible.
2915
+ // _msgerWindow is a msger-native control message (consumed
2916
+ // by the Rust side, never forwarded to the page).
2917
+ handle.send({ _msgerWindow: "focus" });
2891
2918
  }, 50);
2892
2919
  });
2893
2920
  }
@@ -2922,6 +2949,12 @@ RFC 5322 with CRLF line endings. Bodies are quoted-printable encoded (readable i
2922
2949
  handle.send({ _event: "openShare", type: "openShare",
2923
2950
  title: data.title, text: data.text, url: data.url,
2924
2951
  attachments, skipped });
2952
+ // The share sheet was on top of another app — bring our
2953
+ // window to the front so the compose the share opened is
2954
+ // actually visible (Bob 2026-07-30: "should've brought
2955
+ // the new window to the front"). Native msger command —
2956
+ // see the mailto block above.
2957
+ handle.send({ _msgerWindow: "focus" });
2925
2958
  }, 50);
2926
2959
  });
2927
2960
  }