Skip to content

Commit 1028c6b

Browse files
ueokandeCopilot
andcommitted
debug: add diagnostic logging for macOS Edge install
- Log extracted pkg directory tree (3 levels) after xar -xf - Check codesign, xattr, and spctl on app before caching - Log cached binary path and existence after tc.cacheDir - Capture stdout/stderr/exitCode in test() for diagnosis Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9052058 commit 1028c6b

1 file changed

Lines changed: 44 additions & 1 deletion

File tree

src/installer_mac.ts

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,20 @@ export class MacInstaller implements Installer {
6060

6161
await exec.exec("xar", ["-xf", archive], { cwd: extdir });
6262

63+
// Log directory tree to diagnose where the .app bundle is located
64+
const walk = async (dir: string, depth = 0): Promise<void> => {
65+
if (depth > 3) return;
66+
for (const e of await fs.promises.readdir(dir)) {
67+
core.info(`${" ".repeat(depth)}${e}`);
68+
const full = path.join(dir, e);
69+
if ((await fs.promises.stat(full)).isDirectory()) {
70+
await walk(full, depth + 1);
71+
}
72+
}
73+
};
74+
core.info(`Extracted pkg structure under ${extdir}:`);
75+
await walk(extdir);
76+
6377
const pkgdir = (await fs.promises.readdir(extdir)).filter(
6478
(e) => e.startsWith("MicrosoftEdge") && e.endsWith(".pkg"),
6579
)[0];
@@ -76,8 +90,26 @@ export class MacInstaller implements Installer {
7690
await exec.exec("cpio", ["--extract", "--file", "App"], { cwd: pkgroot });
7791

7892
const app = path.join(pkgroot, this.appName(version));
93+
94+
// Diagnose codesign and quarantine attributes before caching
95+
core.info(`App path: ${app}`);
96+
core.info(`App exists: ${fs.existsSync(app)}`);
97+
await exec.exec("codesign", ["--verify", "--verbose=4", app], {
98+
ignoreReturnCode: true,
99+
});
100+
await exec.exec("xattr", ["-l", app], { ignoreReturnCode: true });
101+
await exec.exec("spctl", ["-a", "-v", app], { ignoreReturnCode: true });
102+
79103
const root = await tc.cacheDir(app, "msedge", version);
80104

105+
// Diagnose cached binary
106+
const cachedBin = path.join(root, this.binPath(version));
107+
core.info(`Cached binary: ${cachedBin}`);
108+
core.info(`Cached binary exists: ${fs.existsSync(cachedBin)}`);
109+
await exec.exec("ls", ["-la", path.dirname(cachedBin)], {
110+
ignoreReturnCode: true,
111+
});
112+
81113
return { root, bin: this.binPath(version) };
82114
}
83115

@@ -110,6 +142,17 @@ export class MacInstaller implements Installer {
110142
async test(version: versions.Version): Promise<void> {
111143
const bin = path.basename(this.binPath(version));
112144
const msedgeBin = await io.which(bin, true);
113-
await exec.exec(`"${msedgeBin}"`, ["--version"]);
145+
core.info(`Testing binary: ${msedgeBin}`);
146+
const output = await exec.getExecOutput(`"${msedgeBin}"`, ["--version"], {
147+
ignoreReturnCode: true,
148+
});
149+
core.info(`stdout: ${output.stdout}`);
150+
core.info(`stderr: ${output.stderr}`);
151+
core.info(`exit code: ${output.exitCode}`);
152+
if (output.exitCode !== 0) {
153+
throw new Error(
154+
`Edge binary test failed with exit code ${output.exitCode}\nstderr: ${output.stderr}`,
155+
);
156+
}
114157
}
115158
}

0 commit comments

Comments
 (0)