mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-11 13:24:55 +01:00
fix(cli): preserve installs when service state is unknown
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
06e8d2f387
commit
e64d383b6f
2 files changed
+49
-2
No files matched your search
@@ -107,6 +107,33 @@ describe("managed install commands", () => {
|
||||
expect(fs.readFileSync(userData, "utf8")).toBe("keep");
|
||||
});
|
||||
|
||||
it("preserves the managed install when an existing systemd unit cannot be checked", async () => {
|
||||
const paths = resolveInstallStorePaths();
|
||||
fs.mkdirSync(path.dirname(paths.shimPath), { recursive: true });
|
||||
fs.writeFileSync(paths.shimPath, "managed shim");
|
||||
const unitPath = path.join(
|
||||
process.env.HOME!,
|
||||
".config",
|
||||
"systemd",
|
||||
"user",
|
||||
"paperclipai.service",
|
||||
);
|
||||
fs.mkdirSync(path.dirname(unitPath), { recursive: true });
|
||||
fs.writeFileSync(unitPath, "unit");
|
||||
|
||||
await expect(uninstallCommand({
|
||||
detectServiceManager: vi.fn(async () => ({
|
||||
supported: false as const,
|
||||
reason: "No usable systemd user manager was detected",
|
||||
})),
|
||||
platform: "linux",
|
||||
userHomeDir: process.env.HOME!,
|
||||
})).rejects.toThrow("Cannot verify or remove the background service");
|
||||
|
||||
expect(fs.existsSync(paths.shimPath)).toBe(true);
|
||||
expect(fs.existsSync(unitPath)).toBe(true);
|
||||
});
|
||||
|
||||
it("rejects a symlinked installs root before npm writes outside the store", async () => {
|
||||
const paths = resolveInstallStorePaths();
|
||||
const outside = path.join(root, "outside");
|
||||
|
||||
Reference in new issue
Block a user