History

fix(cloud): spawn relay client without shell

Julius Marminge committed 5 months ago

Commit 0ccb1ef1 parent 06440773 files · +17 −12Browse files

Unified · Split

3 files
  1. apps/server/src/cloud/ManagedEndpointRuntime.test.ts +7 −2
  2. apps/server/src/cloud/ManagedEndpointRuntime.ts +9 −9
  3. packages/shared/src/relayClient.ts +1 −1
apps/server/src/cloud/ManagedEndpointRuntime.test.ts+7−2
@@ -106,12 +106,17 @@ describe("CloudManagedEndpointRuntime", () => { · 105 unmodified lines
106 106
107 expect(spawned.map((command) => command.command)).toEqual(["cloudflared", "cloudflared"]);107 expect(spawned.map((command) => command.command)).toEqual(["cloudflared", "cloudflared"]);
108 expect(spawned.map((command) => command.args)).toEqual([108 expect(spawned.map((command) => command.args)).toEqual([
109 ["tunnel", "run", "--token", "token-1"],109 ["tunnel", "run"],
110 ["tunnel", "run", "--token", "token-2"],110 ["tunnel", "run"],
111 ]);
112 expect(spawned.map((command) => command.options.env?.TUNNEL_TOKEN)).toEqual([
113 "token-1",
114 "token-2",
111 ]);115 ]);
112 expect(spawned.map((command) => command.options.stdout)).toEqual(["ignore", "ignore"]);116 expect(spawned.map((command) => command.options.stdout)).toEqual(["ignore", "ignore"]);
113 expect(spawned.map((command) => command.options.stderr)).toEqual(["ignore", "ignore"]);117 expect(spawned.map((command) => command.options.stderr)).toEqual(["ignore", "ignore"]);
114 expect(spawned.map((command) => command.options.detached)).toEqual([false, false]);118 expect(spawned.map((command) => command.options.detached)).toEqual([false, false]);
119 expect(spawned.map((command) => command.options.shell)).toEqual([false, false]);
115 expect(killed).toEqual([100, 101]);120 expect(killed).toEqual([100, 101]);
116 expect(stopped).toEqual({ status: "disabled" });121 expect(stopped).toEqual({ status: "disabled" });
117 }),122 }),
apps/server/src/cloud/ManagedEndpointRuntime.ts+9−9
@@ -185,16 +185,16 @@ export const makeCloudManagedEndpointRuntime = Effect.gen(function* () { · 184 unmodified lines
185 const connectorScope = yield* Scope.make("sequential");185 const connectorScope = yield* Scope.make("sequential");
186 const child = yield* spawner186 const child = yield* spawner
187 .spawn(187 .spawn(
188 ChildProcess.make(188 ChildProcess.make(executable.executablePath, ["tunnel", "run"], {
189 executable.executablePath,189 detached: false,
190 ["tunnel", "run", "--token", config.connectorToken],190 env: {
191 {191 ...process.env,
192 detached: false,192 TUNNEL_TOKEN: config.connectorToken,
193 shell: process.platform === "win32",
194 stderr: "ignore",
195 stdout: "ignore",
196 },193 },
197 ),194 shell: false,
195 stderr: "ignore",
196 stdout: "ignore",
197 }),
198 )198 )
199 .pipe(199 .pipe(
200 Effect.provideService(Scope.Scope, connectorScope),200 Effect.provideService(Scope.Scope, connectorScope),
packages/shared/src/relayClient.ts+1−1
@@ -292,7 +292,7 @@ export const makeCloudflaredRelayClient = Effect.fn("cloudflared.make")(function · 291 unmodified lines
292 ) {292 ) {
293 const child = yield* spawner.spawn(293 const child = yield* spawner.spawn(
294 ChildProcess.make(command, args, {294 ChildProcess.make(command, args, {
295 shell: platform === "win32",295 shell: false,
296 stdout: "ignore",296 stdout: "ignore",
297 stderr: "ignore",297 stderr: "ignore",
298 }),298 }),