mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Merge pull request #782 from RooVetGit/safer_profile_path_check
Safer profile path check
This commit is contained in:
commit
08ce4826b3
3 changed files with 12 additions and 1 deletions
5
.changeset/heavy-feet-judge.md
Normal file
5
.changeset/heavy-feet-judge.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"roo-cline": patch
|
||||
---
|
||||
|
||||
Safer shell profile path check
|
||||
|
|
@ -97,6 +97,12 @@ describe("Shell Detection Tests", () => {
|
|||
expect(getShell()).toBe("C:\\Windows\\System32\\cmd.exe")
|
||||
})
|
||||
|
||||
it("handles undefined profile gracefully", () => {
|
||||
// Mock a case where defaultProfileName exists but the profile doesn't
|
||||
mockVsCodeConfig("windows", "NonexistentProfile", {})
|
||||
expect(getShell()).toBe("C:\\Windows\\System32\\cmd.exe")
|
||||
})
|
||||
|
||||
it("respects userInfo() if no VS Code config is available", () => {
|
||||
vscode.workspace.getConfiguration = () => ({ get: () => undefined }) as any
|
||||
;(userInfo as any) = () => ({ shell: "C:\\Custom\\PowerShell.exe" })
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ function getWindowsShellFromVSCode(): string | null {
|
|||
}
|
||||
|
||||
// If there's a specific path, return that immediately
|
||||
if (profile.path) {
|
||||
if (profile?.path) {
|
||||
return profile.path
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue