Skip to content

Commit 0d3dcd4

Browse files
committed
Fix that the app may freeze when trying to fetch user environment path
1 parent e2a86c1 commit 0d3dcd4

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

Core/Sources/GitHubCopilotService/GitHubCopilotService.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ public class GitHubCopilotBaseService {
6666
self.projectRootURL = projectRootURL
6767
let (server, localServer) = try {
6868
let urls = try GitHubCopilotBaseService.createFoldersIfNeeded()
69-
var userEnvPath = ProcessInfo.processInfo.userEnvironment["PATH"] ?? ""
70-
if userEnvPath.isEmpty {
71-
userEnvPath = "/usr/bin:/usr/local/bin" // fallback
72-
}
7369
let executionParams: Process.ExecutionParameters
7470
let runner = UserDefaults.shared.value(for: \.runNodeWith)
7571

@@ -95,7 +91,7 @@ public class GitHubCopilotBaseService {
9591
)
9692
}()
9793
case .shell:
98-
let shell = ProcessInfo.processInfo.userEnvironment["SHELL"] ?? "/bin/bash"
94+
let shell = ProcessInfo.processInfo.shellExecutablePath
9995
let nodePath = UserDefaults.shared.value(for: \.nodePath)
10096
let command = [
10197
nodePath.isEmpty ? "node" : nodePath,
@@ -111,6 +107,7 @@ public class GitHubCopilotBaseService {
111107
)
112108
}()
113109
case .env:
110+
let userEnvPath = "/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
114111
executionParams = {
115112
let nodePath = UserDefaults.shared.value(for: \.nodePath)
116113
return Process.ExecutionParameters(

0 commit comments

Comments
 (0)