dsh-cloud-experts 0.1.1 → 0.1.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.
- package/README.md +1 -1
- package/lib/index.js +12 -2
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/index.js
CHANGED
|
@@ -69,7 +69,8 @@ class CloudExpertProvider {
|
|
|
69
69
|
const stamp = new Date().toISOString().replace(/[^0-9]/g, "").slice(0, 14);
|
|
70
70
|
const consultId = `PLUGIN-${stamp}-${this.expert}-${randomUUID().slice(0, 8)}`;
|
|
71
71
|
const remoteCmd = [this.config.remoteEntry, this.expert, "--id", consultId, "--origin", this.config.origin].join(" ");
|
|
72
|
-
const argv = ["ssh", "-o", "BatchMode=yes", "-o", "IdentitiesOnly=yes", "-o", "ConnectTimeout=15"
|
|
72
|
+
const argv = ["ssh", "-o", "BatchMode=yes", "-o", "IdentitiesOnly=yes", "-o", "ConnectTimeout=15",
|
|
73
|
+
"-o", "ServerAliveInterval=15", "-o", "ServerAliveCountMax=4", "-o", "LogLevel=ERROR"];
|
|
73
74
|
if (this.config.keyPath) argv.push("-i", this.config.keyPath);
|
|
74
75
|
argv.push(this.config.host, remoteCmd);
|
|
75
76
|
|
|
@@ -91,6 +92,11 @@ class CloudExpertProvider {
|
|
|
91
92
|
const stdinWrite = writeAll(child.stdin, Buffer.from(text, "utf8")).catch(() => {});
|
|
92
93
|
|
|
93
94
|
const controller = new AbortController();
|
|
95
|
+
const watchdog = setTimeout(() => {
|
|
96
|
+
try { child.stdin?.end(); } catch {}
|
|
97
|
+
try { child.terminate(); } catch {}
|
|
98
|
+
controller.abort(new Error(`cloud-experts: ${this.expert} local watchdog fired (360s)`));
|
|
99
|
+
}, 360000);
|
|
94
100
|
const requestCancel = () => {
|
|
95
101
|
if (!controller.signal.aborted) controller.abort(new Error(`cloud-experts: ${this.expert} run cancelled locally`));
|
|
96
102
|
try { child.stdin?.end(); } catch {}
|
|
@@ -100,7 +106,8 @@ class CloudExpertProvider {
|
|
|
100
106
|
request.signal.addEventListener("abort", onAbort, { once: true });
|
|
101
107
|
|
|
102
108
|
const attempt = async () => {
|
|
103
|
-
|
|
109
|
+
try {
|
|
110
|
+
await stdinWrite;
|
|
104
111
|
const info = await child.done;
|
|
105
112
|
const code = info && typeof info.code === "number" ? info.code : 0;
|
|
106
113
|
const envelope = /FED_ENVELOPE:(\{[^\n]*\})/.exec(err);
|
|
@@ -113,6 +120,9 @@ class CloudExpertProvider {
|
|
|
113
120
|
}
|
|
114
121
|
const failure = /FED_ERROR:([\w:.-]+)/.exec(err);
|
|
115
122
|
throw new Error(`cloud-experts: ${failure?.[1] ?? `exit-${code}`} ${err.slice(0, 200)}`);
|
|
123
|
+
} finally {
|
|
124
|
+
clearTimeout(watchdog);
|
|
125
|
+
}
|
|
116
126
|
};
|
|
117
127
|
|
|
118
128
|
const result = settleRunResult({
|
package/package.json
CHANGED