Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(ssh): stop killing the managed server on reconnect #13341

Closedmorgaesis(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/13341/headopened View on GitHub

Showing 2 changed files with 138 additions and 0 deletions.

x
0 of 2 viewed, 2 left
133 additions and 0 deletionspackages/ssh/src/tunnel.test.tsModified
View file
@@ -9,6 +9,7 @@
import * as FileSystem from "effect/FileSystem";
import * as Layer from "effect/Layer";
import * as Result from "effect/Result";
+import * as Schedule from "effect/Schedule";
import * as Sink from "effect/Sink";
import * as Stream from "effect/Stream";
import { TestClock } from "effect/testing";
@@ -806,3 +807,135 @@
60_000,
});
+​
+describe.skipIf(HostProcessPlatform.defaultValue() === "win32")("remote launch reconnect", () => {
+ // Stand-in for `t3 serve`: answers the readiness probe and records itself in
+ // the default-home runtime file, as every server with that base dir does.
+ const SERVER_SCRIPT = `import * as fs from "node:fs";
+import * as http from "node:http";
+const arg = (name) => process.argv[process.argv.indexOf(name) + 1];
+const runtimeDir = arg("--base-dir") + "/userdata";
+const server = http.createServer((_request, response) => response.end("ready"));
+server.listen(Number(arg("--port")), "127.0.0.1", () => {
+ const port = server.address().port;
+ fs.mkdirSync(runtimeDir, { recursive: true });
+ fs.writeFileSync(
+ runtimeDir + "/server-runtime.json",
+ JSON.stringify({ pid: process.pid, port, origin: "http://127.0.0.1:" + port }),
+ );
+});