Skip to content

Commit b8b4bb3

Browse files
fix(server): allow SSH startup time before encoder probing
1 parent 9e80ff7 commit b8b4bb3

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

‎apps/server/src/device/DeviceService.ts‎

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -672,33 +672,29 @@ export const makeWithHosts = Effect.fn("DeviceService.makeWithHosts")(function*
672672
return yield* new DeviceNotFoundError({ hostId: host.id, deviceId: input.deviceId });
673673
}
674674
if (device.platform === "android" && !device.physical) {
675-
// Resolve the override on the device host, in the same environment and cwd as its hub.
676-
const encoders = yield* ready.run(
677-
ready.nodePath,
678-
[
679-
"-e",
680-
`const { spawnSync } = require("node:child_process");
675+
// Resolve the override on the device host the way its hub does.
676+
const encoders = yield* ready.run(ready.nodePath, [
677+
"-e",
678+
`const { spawnSync } = require("node:child_process");
681679
const result = spawnSync(process.env.SERVE_EMU_FFMPEG?.trim() || "ffmpeg", ["-hide_banner", "-encoders"], {
682680
stdio: "inherit", timeout: 10000, killSignal: "SIGKILL",
683681
});
684682
process.exitCode = result.error ? 1 : (result.status ?? 1);`,
685-
],
686-
{ timeoutMs: 10_000 },
687-
);
683+
]);
688684
if (encoders.code !== 0) {
689685
return yield* new DevicePlatformUnavailableError({
690686
hostId: host.id,
691687
platform: "android",
692688
reason:
693-
"Android emulator video needs working ffmpeg with the libx264 encoder. Install it on the device host's PATH or set SERVE_EMU_FFMPEG there, then retry opening the emulator. After changing PATH or SERVE_EMU_FFMPEG, restart SSH device support or the local environment server.",
689+
"Android emulator video needs working ffmpeg with the libx264 encoder. Install it on the device host's PATH or set SERVE_EMU_FFMPEG there, then retry opening the emulator. After changing PATH or SERVE_EMU_FFMPEG, turn device support off and on for SSH hosts, or restart the local environment server.",
694690
});
695691
}
696692
if (!/\blibx264\b/.test(`${encoders.stdout}\n${encoders.stderr}`)) {
697693
return yield* new DevicePlatformUnavailableError({
698694
hostId: host.id,
699695
platform: "android",
700696
reason:
701-
"Android emulator video needs the libx264 encoder. Install an ffmpeg build that includes libx264 on the device host, then retry opening the emulator. After changing PATH or SERVE_EMU_FFMPEG, restart SSH device support or the local environment server.",
697+
"Android emulator video needs the libx264 encoder. Install an ffmpeg build that includes libx264 on the device host, then retry opening the emulator. After changing PATH or SERVE_EMU_FFMPEG, turn device support off and on for SSH hosts, or restart the local environment server.",
702698
});
703699
}
704700
}

0 commit comments

Comments
 (0)