Skip to content

Commit 10b8ee4

Browse files
authored
Fix bug when shell profile is not found (RooCodeInc#1671)
1 parent 548338d commit 10b8ee4

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/test/shell.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ describe("Shell Detection Tests", () => {
7878
expect(getShell()).to.equal("C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe")
7979
})
8080

81+
it("handles undefined shell profile gracefully", () => {
82+
mockVsCodeConfig("windows", "NonExistentProfile", {})
83+
expect(getShell()).to.equal("C:\\Windows\\System32\\cmd.exe")
84+
})
85+
8186
it("uses WSL bash when profile indicates WSL source", () => {
8287
mockVsCodeConfig("windows", "WSL", {
8388
WSL: { source: "WSL" },

src/utils/shell.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function getWindowsShellFromVSCode(): string | null {
105105
}
106106

107107
// If there's a specific path, return that immediately
108-
if (profile.path) {
108+
if (profile?.path) {
109109
return profile.path
110110
}
111111

0 commit comments

Comments
 (0)