mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-06 23:44:36 +00:00
fix(coding-agent): accept managed install markers with a UTF-8 BOM
Windows PowerShell 5.1 adds a BOM when it rewrites managed-install.json, which made pi update fail with "Managed install marker is missing or invalid".
This commit is contained in:
parent
530015d93a
commit
ea25697e91
3 changed files with 21 additions and 1 deletions
|
|
@ -697,6 +697,24 @@ if (process.platform !== "win32") fs.chmodSync(piPath, 0o755);
|
|||
expect(process.exitCode).toBeUndefined();
|
||||
});
|
||||
|
||||
it("accepts a managed install marker with a UTF-8 BOM", async () => {
|
||||
const targetVersion = getNewerPatchVersion();
|
||||
const { managedRoot } = prepareManagedInstall(targetVersion);
|
||||
writeFileSync(
|
||||
join(managedRoot, "managed-install.json"),
|
||||
`\uFEFF${JSON.stringify({ kind: "pi-managed-install", schemaVersion: 1, layout: "releases-v1" })}\r\n`,
|
||||
);
|
||||
mockManagedUpdate(targetVersion);
|
||||
vi.spyOn(console, "log").mockImplementation(() => {});
|
||||
const errorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
|
||||
|
||||
await expect(runPackageCommandDirectly(["update", "--self"])).resolves.toBeUndefined();
|
||||
|
||||
expect(readFileSync(join(managedRoot, "current-version"), "utf8")).toBe(`${targetVersion}\n`);
|
||||
expect(errorSpy).not.toHaveBeenCalled();
|
||||
expect(process.exitCode).toBeUndefined();
|
||||
});
|
||||
|
||||
it("removes older managed releases after an update", async () => {
|
||||
// https://github.com/earendil-works/pi/issues/10392
|
||||
const targetVersion = getNewerPatchVersion();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue