Ignore temp file delete error since system will clean up anyways

This commit is contained in:
Saoud Rizwan 2024-08-31 10:07:41 -04:00
parent 98ea81b8a2
commit 5f2b66383c
2 changed files with 12 additions and 3 deletions

View File

@ -2,7 +2,7 @@
"name": "claude-dev",
"displayName": "Claude Dev",
"description": "Autonomous coding agent right in your IDE, capable of creating/editing files, executing commands, and more with your permission every step of the way.",
"version": "1.5.10",
"version": "1.5.11",
"icon": "icon.png",
"engines": {
"vscode": "^1.84.0"

View File

@ -858,7 +858,12 @@ export class ClaudeDev {
if (response !== "yesButtonTapped") {
await this.closeDiffViews()
// Clean up the temporary file
await fs.rm(tempDir, { recursive: true, force: true })
try {
await fs.rm(tempDir, { recursive: true, force: true })
} catch (error) {
// deleting temp file failed (seems to happen on some windows machines), which is okay since system will clean it up anyways
console.error(`Error deleting temporary directory: ${error}`)
}
if (response === "messageResponse") {
await this.say("user_feedback", text, images)
return this.formatIntoToolResponse(await this.formatGenericToolFeedback(text), images)
@ -874,7 +879,11 @@ export class ClaudeDev {
await fs.writeFile(absolutePath, editedContent)
// Clean up the temporary file
await fs.rm(tempDir, { recursive: true, force: true })
try {
await fs.rm(tempDir, { recursive: true, force: true })
} catch (error) {
console.error(`Error deleting temporary directory: ${error}`)
}
// Finish by opening the edited file in the editor
await vscode.window.showTextDocument(vscode.Uri.file(absolutePath), { preview: false })