Skip to content

Commit 970db18

Browse files
If running under bun, fall back on finding node from path
1 parent 397ef66 commit 970db18

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

nodejs/src/client.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ function toJsonSchema(parameters: Tool["parameters"]): Record<string, unknown> |
107107
* ```
108108
*/
109109

110+
function getNodeExecPath(): string {
111+
if (process.versions.bun) {
112+
return "node";
113+
}
114+
return process.execPath;
115+
}
116+
110117
/**
111118
* Gets the path to the bundled CLI from the @github/copilot package.
112119
* Uses index.js directly rather than npm-loader.js (which spawns the native binary).
@@ -1070,7 +1077,7 @@ export class CopilotClient {
10701077
// For .js files, spawn node explicitly; for executables, spawn directly
10711078
const isJsFile = this.options.cliPath.endsWith(".js");
10721079
if (isJsFile) {
1073-
this.cliProcess = spawn(process.execPath, [this.options.cliPath, ...args], {
1080+
this.cliProcess = spawn(getNodeExecPath(), [this.options.cliPath, ...args], {
10741081
stdio: stdioConfig,
10751082
cwd: this.options.cwd,
10761083
env: envWithoutNodeDebug,

0 commit comments

Comments
 (0)