Skip to content

Commit d716269

Browse files
committed
Inherit path from login shell
1 parent 381e64d commit d716269

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

Core/Sources/CopilotService/CopilotService.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ public class CopilotBaseService {
5151
try? FileManager.default
5252
.createDirectory(at: supportURL, withIntermediateDirectories: false)
5353
}
54+
var userEnvPath = ProcessInfo.processInfo.userEnvironment["PATH"] ?? ""
55+
if userEnvPath.isEmpty {
56+
userEnvPath = "/usr/bin:/usr/local/bin" // fallback
57+
}
5458
let executionParams = {
5559
let nodePath = UserDefaults.shared.value(for: \.nodePath)
5660
return Process.ExecutionParameters(
@@ -65,7 +69,7 @@ public class CopilotBaseService {
6569
"--stdio",
6670
],
6771
environment: [
68-
"PATH": "/usr/bin:/usr/local/bin",
72+
"PATH": userEnvPath,
6973
],
7074
currentDirectoryURL: supportURL
7175
)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Or install it manually, by downloading the `Copilot for Xcode.app` from the late
5959
Then set it up with the following steps:
6060

6161
1. Open the app, the app will create a launch agent to setup a background running Service that does the real job.
62-
2. Optionally setup the path to Node. The default value is just `node`, Copilot for Xcode.app will try to find the Node from `/usr/bin:/usr/local/bin`. If your Node is installed somewhere else, you can run `which node` from terminal to get the path.
62+
2. Optionally setup the path to Node. The default value is just `node`, Copilot for Xcode.app will try to find the Node from the PATH available in a login shell. If your Node is installed somewhere else, you can run `which node` from terminal to get the path.
6363

6464
### Enable the Extension
6565

0 commit comments

Comments
 (0)