Skip to content

Commit 658d328

Browse files
PR Batch Testerclaude
authored andcommitted
fix(desktop): Linux afterPack keeps the server bytecode cache step
Main now sets afterPack to prepare-server-compile-cache.cjs for every platform, and the Linux hook replaced it. The Linux hook now runs that step first, then removes shared write access, so the cache files it writes are covered too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent b9f1c34 commit 658d328

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

‎scripts/linux-after-pack.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import * as NodeOS from "node:os";
55
import * as NodePath from "node:path";
66
import { describe, expect, it } from "vite-plus/test";
77

8-
import afterPack from "./linux-after-pack.ts";
8+
import { removeSharedWriteAccess } from "./linux-after-pack.ts";
99

10-
describe.skipIf(HostProcess.Platform.defaultValue() === "win32")("linux afterPack", () => {
10+
describe.skipIf(HostProcess.Platform.defaultValue() === "win32")("removeSharedWriteAccess", () => {
1111
it("removes group and other write access from the packed app only", async () => {
1212
const root = await NodeFSP.mkdtemp(NodePath.join(NodeOS.tmpdir(), "t3-after-pack-"));
1313
try {
@@ -28,7 +28,7 @@ describe.skipIf(HostProcess.Platform.defaultValue() === "win32")("linux afterPac
2828
await NodeFSP.chmod(NodePath.join(appOutDir, "resources"), 0o777);
2929
await NodeFSP.symlink("../outside", NodePath.join(appOutDir, "linked-dir"));
3030

31-
await afterPack({ appOutDir });
31+
await removeSharedWriteAccess(appOutDir);
3232

3333
for (const [file, [, after]] of Object.entries(modes)) {
3434
const { mode } = await NodeFSP.stat(NodePath.join(root, file));

‎scripts/linux-after-pack.ts‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
// @effect-diagnostics nodeBuiltinImport:off
22
import * as NodeFSP from "node:fs/promises";
3+
import * as NodeModule from "node:module";
34
import * as NodePath from "node:path";
45

6+
const prepareServerCompileCache: (context: AfterPackContext) => Promise<void> =
7+
NodeModule.createRequire(import.meta.url)("./prepare-server-compile-cache.cjs");
8+
9+
interface AfterPackContext {
10+
readonly appOutDir: string;
11+
}
12+
513
// Electron's Linux zips can ship world-writable files (44.10.0 has 0777 binaries), and
614
// electron-builder copies zip modes verbatim into the .deb and AppImage.
7-
export default async function afterPack(context: { readonly appOutDir: string }): Promise<void> {
15+
export default async function afterPack(context: AfterPackContext): Promise<void> {
16+
await prepareServerCompileCache(context);
817
await removeSharedWriteAccess(context.appOutDir);
918
}
1019

1120
// Walks by hand: recursive readdir follows directory symlinks out of the app folder.
12-
async function removeSharedWriteAccess(path: string): Promise<void> {
21+
export async function removeSharedWriteAccess(path: string): Promise<void> {
1322
const stats = await NodeFSP.lstat(path);
1423
if (stats.isSymbolicLink()) return;
1524
if (stats.mode & 0o022) await NodeFSP.chmod(path, stats.mode & 0o7755);

0 commit comments

Comments
 (0)