Skip to content

Commit eb249b2

Browse files
fix(release): accept node-pty's prebuilt binary in the Windows WSL runtime
node-pty 1.2.0-beta.15 (pingdotgg#13748) ships its Linux binary under prebuilds/linux-<arch>/pty.node instead of build/Release/pty.node, so the Windows packaging check rejected every embedded Linux CLI archive and the Windows builds failed. The check now accepts either location, the same ones the WSL startup probe already looks in.
1 parent 95030dc commit eb249b2

2 files changed

Lines changed: 40 additions & 9 deletions

File tree

‎scripts/build-desktop-artifact.test.ts‎

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,13 @@ import { symlinksSupported } from "@t3tools/shared/testing/symlinks";
9696

9797
// A minimal stand-in for the Linux CLI release archive: one top-level
9898
// directory named after the archive stem holding the executable, the web
99-
// client, and the runtime externals with node-pty built from source.
99+
// client, and the runtime externals with node-pty's prebuilt binary.
100100
const makeLinuxCliArchiveFixture = Effect.fn("test.makeLinuxCliArchiveFixture")(function* (input: {
101101
readonly root: string;
102102
readonly stem: string;
103103
readonly extraMembers?: ReadonlyArray<string>;
104104
readonly omitMembers?: ReadonlyArray<string>;
105+
readonly ptyMember?: string;
105106
}) {
106107
const fs = yield* FileSystem.FileSystem;
107108
const path = yield* Path.Path;
@@ -111,7 +112,7 @@ const makeLinuxCliArchiveFixture = Effect.fn("test.makeLinuxCliArchiveFixture")(
111112
`${input.stem}/t3`,
112113
`${input.stem}/client/index.html`,
113114
`${input.stem}/node_modules/node-pty/package.json`,
114-
`${input.stem}/node_modules/node-pty/build/Release/pty.node`,
115+
`${input.stem}/node_modules/node-pty/${input.ptyMember ?? "prebuilds/linux-x64/pty.node"}`,
115116
...(input.extraMembers ?? []),
116117
].filter((member) => !(input.omitMembers ?? []).includes(member));
117118
for (const member of members) {
@@ -174,7 +175,12 @@ const WINDOWS_PAYLOAD_FIXTURE_VERSION = "1.2.3";
174175
const makeWindowsPayloadFixture = Effect.fn("test.makeWindowsPayloadFixture")(function* (input: {
175176
readonly copyUnpackedNatives: boolean;
176177
readonly serverEntrySource?: string;
177-
readonly wslRuntime?: "valid" | "loose-server-tree" | "missing-pty" | "bad-digest";
178+
readonly wslRuntime?:
179+
| "valid"
180+
| "source-built-pty"
181+
| "loose-server-tree"
182+
| "missing-pty"
183+
| "bad-digest";
178184
}) {
179185
const fs = yield* FileSystem.FileSystem;
180186
const path = yield* Path.Path;
@@ -227,7 +233,10 @@ const makeWindowsPayloadFixture = Effect.fn("test.makeWindowsPayloadFixture")(fu
227233
root: path.join(tempDir, "wsl-runtime"),
228234
stem,
229235
...(input.wslRuntime === "missing-pty"
230-
? { omitMembers: [`${stem}/node_modules/node-pty/build/Release/pty.node`] }
236+
? { omitMembers: [`${stem}/node_modules/node-pty/prebuilds/linux-x64/pty.node`] }
237+
: {}),
238+
...(input.wslRuntime === "source-built-pty"
239+
? { ptyMember: "build/Release/pty.node" }
231240
: {}),
232241
});
233242
const archivePath = path.join(resourcesDir, WSL_RUNTIME_ARCHIVE_NAME);
@@ -1266,6 +1275,24 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
12661275
),
12671276
);
12681277

1278+
it.effect("accepts an embedded archive with a source-built node-pty binary", () =>
1279+
Effect.scoped(
1280+
Effect.gen(function* () {
1281+
const fixture = yield* makeWindowsPayloadFixture({
1282+
copyUnpackedNatives: true,
1283+
wslRuntime: "source-built-pty",
1284+
});
1285+
yield* validateWindowsPackagedPayload({
1286+
stageDistDir: fixture.stageDistDir,
1287+
appExecutableName: fixture.appExecutableName,
1288+
targetArch: "x64",
1289+
appVersion: WINDOWS_PAYLOAD_FIXTURE_VERSION,
1290+
expectWslRuntime: true,
1291+
});
1292+
}),
1293+
),
1294+
);
1295+
12691296
it.effect("rejects an embedded archive without the Linux node-pty binary", () =>
12701297
Effect.scoped(
12711298
Effect.gen(function* () {
@@ -1284,7 +1311,7 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
12841311
assert.instanceOf(error, WindowsPackagedPayloadValidationError);
12851312
assert.equal(error.reason, "wsl-runtime-invalid");
12861313
assert.deepStrictEqual(error.missingFiles, [
1287-
`${wslRuntimeArchiveStem(WINDOWS_PAYLOAD_FIXTURE_VERSION, "x64")}/node_modules/node-pty/build/Release/pty.node`,
1314+
`${wslRuntimeArchiveStem(WINDOWS_PAYLOAD_FIXTURE_VERSION, "x64")}/node_modules/node-pty/prebuilds/linux-x64/pty.node`,
12881315
]);
12891316
}),
12901317
),

‎scripts/build-desktop-artifact.ts‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3291,13 +3291,17 @@ export const validateWindowsPackagedPayload = Effect.fn(
32913291
),
32923292
);
32933293
}
3294-
const requiredMembers = [
3295-
`${stem}/t3`,
3296-
`${stem}/client`,
3297-
`${stem}/node_modules`,
3294+
// node-pty ships a prebuilt binary; a source build lands in build/Release.
3295+
// The WSL startup probe accepts either, the same places node-pty loads from.
3296+
const ptyMembers = [
3297+
`${stem}/node_modules/node-pty/prebuilds/linux-${input.targetArch}/pty.node`,
32983298
`${stem}/node_modules/node-pty/build/Release/pty.node`,
32993299
];
3300+
const requiredMembers = [`${stem}/t3`, `${stem}/client`, `${stem}/node_modules`];
33003301
const missingMembers = requiredMembers.filter((member) => !members.includes(member));
3302+
if (!ptyMembers.some((member) => members.includes(member))) {
3303+
missingMembers.push(ptyMembers[0]!);
3304+
}
33013305
if (missingMembers.length > 0) {
33023306
return yield* new WindowsPackagedPayloadValidationError({
33033307
reason: "wsl-runtime-invalid",

0 commit comments

Comments
 (0)