Browse Source

use workingDir if shellInstance is nil otherwise use cwd if shellInstance is not nil

Fuad 10 months ago
parent
commit
8a4d4152ce
1 changed files with 3 additions and 1 deletions
  1. 3 1
      internal/llm/tools/shell/shell.go

+ 3 - 1
internal/llm/tools/shell/shell.go

@@ -47,8 +47,10 @@ func GetPersistentShell(workingDir string) *PersistentShell {
 		shellInstance = newPersistentShell(workingDir)
 	})
 
-	if shellInstance == nil || !shellInstance.isAlive {
+	if shellInstance == nil {
 		shellInstance = newPersistentShell(workingDir)
+	} else if !shellInstance.isAlive {
+		shellInstance = newPersistentShell(shellInstance.cwd)
 	}
 
 	return shellInstance