@threadbase-sh/streamer 1.17.0 → 1.17.1

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/dist/cli.cjs CHANGED
@@ -124790,12 +124790,23 @@ async function tryBind(start, offset) {
124790
124790
  if (free) return port;
124791
124791
  return tryBind(start, offset + 1);
124792
124792
  }
124793
+ function isPidAlive2(pid) {
124794
+ try {
124795
+ process.kill(pid, 0);
124796
+ return true;
124797
+ } catch {
124798
+ return false;
124799
+ }
124800
+ }
124793
124801
  function takeoverProd(opts) {
124794
124802
  const existing = readMarker();
124795
124803
  if (existing) {
124796
- throw new Error(
124797
- `prod is already suspended by dev pid ${existing.devPid} (since ${existing.suspendedAt}). Stop that dev session first, or run 'tb-streamer prod doctor'.`
124798
- );
124804
+ if (isPidAlive2(existing.devPid)) {
124805
+ throw new Error(
124806
+ `prod is already suspended by dev pid ${existing.devPid} (since ${existing.suspendedAt}). Stop that dev session first, or run 'tb-streamer prod doctor'.`
124807
+ );
124808
+ }
124809
+ log6.info(`stale marker found (pid ${existing.devPid} is gone) \u2014 clearing and proceeding`);
124799
124810
  }
124800
124811
  getSupervisor().bootoutAgent();
124801
124812
  writeMarker({