Browse Source

Ignore temp file delete error since system will clean up anyways

Saoud Rizwan 1 year ago
parent
commit
5f2b66383c
2 changed files with 12 additions and 3 deletions
  1. 1 1
      package.json
  2. 11 2
      src/ClaudeDev.ts

+ 1 - 1
package.json

@@ -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"

+ 11 - 2
src/ClaudeDev.ts

@@ -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 })