Skip to content

Commit 3a9059e

Browse files
committed
fix(shared): bound external cloudflared version checks
1 parent cae1ec0 commit 3a9059e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎packages/shared/src/relayClient.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,12 @@ export const makeCloudflaredRelayClient = Effect.fn("cloudflared.make")(function
218218
stderr: "ignore",
219219
}),
220220
);
221-
const output = yield* child.stdout.pipe(Stream.decodeText(), Stream.mkString);
221+
const output = yield* child.stdout.pipe(
222+
Stream.take(16),
223+
Stream.map((chunk) => chunk.subarray(0, 64)),
224+
Stream.decodeText(),
225+
Stream.mkString,
226+
);
222227
if (Number(yield* child.exitCode) !== 0) return null;
223228
const match = /^cloudflared version (\d+)\.(\d+)\.(\d+)\b/mu.exec(output);
224229
if (!match) return null;
@@ -230,6 +235,7 @@ export const makeCloudflaredRelayClient = Effect.fn("cloudflared.make")(function
230235
return `${version[0]}.${version[1]}.${version[2]}`;
231236
}).pipe(
232237
Effect.scoped,
238+
Effect.timeout("2 seconds"),
233239
Effect.orElseSucceed(() => null),
234240
);
235241

0 commit comments

Comments
 (0)