Skip to content

Commit 408df85

Browse files
committed
Do not log errors for ENOENT
1 parent ec5fe52 commit 408df85

File tree

1 file changed

+6
-1
lines changed
  • extensions/ql-vscode/src/codeql-cli/distribution

1 file changed

+6
-1
lines changed

extensions/ql-vscode/src/codeql-cli/distribution/cleaner.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { ExtensionContext } from "vscode";
2-
import { getDirectoryNamesInsidePath } from "../../common/files";
2+
import { getDirectoryNamesInsidePath, isIOError } from "../../common/files";
33
import { sleep } from "../../common/time";
44
import type { BaseLogger } from "../../common/logging";
55
import { join } from "path";
@@ -109,6 +109,11 @@ export class ExtensionManagedDistributionCleaner {
109109
try {
110110
await remove(path);
111111
} catch (e) {
112+
if (isIOError(e) && e.code === "ENOENT") {
113+
// If the directory doesn't exist, that's fine
114+
continue;
115+
}
116+
112117
void this.logger.log(
113118
`Tried to clean up an old version of the CLI at ${path} but encountered an error: ${getErrorMessage(e)}.`,
114119
);

0 commit comments

Comments
 (0)