@dsh-sup/dsh-core-linux-x64 0.1.3-BETA.1 → 0.1.3-BETA.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.
Files changed (2) hide show
  1. package/core.cjs +15 -3
  2. package/package.json +1 -1
package/core.cjs CHANGED
@@ -143,7 +143,7 @@ var require_version = __commonJS({
143
143
  var fs2 = require("node:fs");
144
144
  var path2 = require("node:path");
145
145
  function guardVersion() {
146
- if (true) return String("0.1.3-BETA.1");
146
+ if (true) return String("0.1.3-BETA.3");
147
147
  try {
148
148
  return JSON.parse(fs2.readFileSync(path2.join(__dirname, "..", "..", "package.json"), "utf8")).version || "unknown";
149
149
  } catch {
@@ -6813,7 +6813,13 @@ var require_frpmgr = __commonJS({
6813
6813
  } catch {
6814
6814
  return { ok: false, error: "no config generated yet" };
6815
6815
  }
6816
- const child = spawn(this.binPath, ["-c", this.configFile], { stdio: ["ignore", "pipe", "pipe"] });
6816
+ let child;
6817
+ try {
6818
+ child = spawn(this.binPath, ["-c", this.configFile], { stdio: ["ignore", "pipe", "pipe"] });
6819
+ } catch (e) {
6820
+ if (this._stableTimer) clearTimeout(this._stableTimer);
6821
+ return { ok: false, error: "frpc spawn failed: " + (e && e.message || e), needInstall: true };
6822
+ }
6817
6823
  this.child = child;
6818
6824
  const pushLog = (line) => {
6819
6825
  line = String(line).trim();
@@ -6821,6 +6827,11 @@ var require_frpmgr = __commonJS({
6821
6827
  this.logTail.push((/* @__PURE__ */ new Date()).toISOString().slice(11, 19) + " " + line);
6822
6828
  if (this.logTail.length > 200) this.logTail.splice(0, this.logTail.length - 200);
6823
6829
  };
6830
+ child.on("error", (e) => {
6831
+ pushLog("[spawn error] " + (e && e.message || e));
6832
+ if (this.child === child) this.child = null;
6833
+ if (!this._intentionalStop) this._scheduleRestart();
6834
+ });
6824
6835
  child.stdout.on("data", (c) => String(c).split("\n").forEach(pushLog));
6825
6836
  child.stderr.on("data", (c) => String(c).split("\n").forEach(pushLog));
6826
6837
  child.on("exit", (code) => {
@@ -7730,8 +7741,9 @@ var require_manager = __commonJS({
7730
7741
  }
7731
7742
  if (!await this.targetReachable(inst)) return;
7732
7743
  const hasPersistedBinding = !!(inst.wanPort && Number.isInteger(Number(inst.wanPort)) && inst.wanPort > 0);
7744
+ const relayPool = ports.rangeOf("relay");
7733
7745
  const slot = await ports.claimSlot("relay", owner, {
7734
- preferred: hasPersistedBinding ? inst.wanPort : inst.id === "main" ? 4e4 : void 0,
7746
+ preferred: hasPersistedBinding ? inst.wanPort : inst.id === "main" ? relayPool.base : void 0,
7735
7747
  bindingPreferred: hasPersistedBinding,
7736
7748
  onBindingLost: (e) => {
7737
7749
  if (this.events) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-sup/dsh-core-linux-x64",
3
- "version": "0.1.3-BETA.1",
3
+ "version": "0.1.3-BETA.3",
4
4
  "description": "DSH lifecycle guard core (Node launcher) for linux-x64 — requires Node >=18.",
5
5
  "license": "UNLICENSED",
6
6
  "os": [