mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-25 09:41:04 +01:00
fix(doctor): ignore empty managed install stores
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
aff4e184cb
commit
b45f2c0b9e
2 files changed
+21
-2
No files matched your search
@@ -72,4 +72,17 @@ describe("managed install doctor checks", () => {
|
||||
expect.objectContaining({ name: "Managed install", status: "pass" }),
|
||||
]);
|
||||
});
|
||||
|
||||
it("ignores an empty installs directory left by a harmless lock lifecycle", () => {
|
||||
const root = fs.mkdtempSync(path.join(os.tmpdir(), "paperclip-install-doctor-"));
|
||||
const paths = resolveInstallStorePaths({
|
||||
paperclipHome: path.join(root, ".paperclip"),
|
||||
homeDir: root,
|
||||
});
|
||||
fs.mkdirSync(paths.installsRoot, { recursive: true });
|
||||
|
||||
expect(managedInstallChecks(paths)).toEqual([
|
||||
expect.objectContaining({ name: "Managed install", status: "pass" }),
|
||||
]);
|
||||
});
|
||||
});
|
||||
@@ -17,13 +17,19 @@ function pathContains(directory: string): boolean {
|
||||
}
|
||||
|
||||
function hasManagedArtifacts(paths: InstallStorePaths): boolean {
|
||||
return [
|
||||
paths.installsRoot,
|
||||
const persistentArtifacts = [
|
||||
paths.manifestPath,
|
||||
paths.markerPath,
|
||||
paths.currentPath,
|
||||
paths.shimPath,
|
||||
].some((entry) => fs.existsSync(entry));
|
||||
if (persistentArtifacts) return true;
|
||||
try {
|
||||
return fs.readdirSync(paths.installsRoot).length > 0;
|
||||
} catch (error) {
|
||||
if ((error as NodeJS.ErrnoException).code === "ENOENT") return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export function nodeRuntimeCheck(): CheckResult {
|
||||
|
||||
Reference in new issue
Block a user