mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-22 17:00:14 +08:00
fix(ProcessTransport): replace spawn with fork for Node.js process handling
This commit is contained in:
parent
65ac3181a8
commit
02cf012671
@ -4,12 +4,12 @@ index 461e9a2ba246778261108a682762ffcf26f7224e..44bd667d9f591969d36a105ba5eb8b47
|
|||||||
+++ b/sdk.mjs
|
+++ b/sdk.mjs
|
||||||
@@ -6215,7 +6215,7 @@ function createAbortController(maxListeners = DEFAULT_MAX_LISTENERS) {
|
@@ -6215,7 +6215,7 @@ function createAbortController(maxListeners = DEFAULT_MAX_LISTENERS) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ../src/transport/ProcessTransport.ts
|
// ../src/transport/ProcessTransport.ts
|
||||||
-import { spawn } from "child_process";
|
-import { spawn } from "child_process";
|
||||||
+import { fork } from "child_process";
|
+import { fork } from "child_process";
|
||||||
import { createInterface } from "readline";
|
import { createInterface } from "readline";
|
||||||
|
|
||||||
// ../src/utils/fsOperations.ts
|
// ../src/utils/fsOperations.ts
|
||||||
@@ -6473,14 +6473,11 @@ class ProcessTransport {
|
@@ -6473,14 +6473,11 @@ class ProcessTransport {
|
||||||
const errorMessage = isNativeBinary(pathToClaudeCodeExecutable) ? `Claude Code native binary not found at ${pathToClaudeCodeExecutable}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.` : `Claude Code executable not found at ${pathToClaudeCodeExecutable}. Is options.pathToClaudeCodeExecutable set?`;
|
const errorMessage = isNativeBinary(pathToClaudeCodeExecutable) ? `Claude Code native binary not found at ${pathToClaudeCodeExecutable}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.` : `Claude Code executable not found at ${pathToClaudeCodeExecutable}. Is options.pathToClaudeCodeExecutable set?`;
|
||||||
@ -19,7 +19,7 @@ index 461e9a2ba246778261108a682762ffcf26f7224e..44bd667d9f591969d36a105ba5eb8b47
|
|||||||
- const spawnCommand = isNative ? pathToClaudeCodeExecutable : executable;
|
- const spawnCommand = isNative ? pathToClaudeCodeExecutable : executable;
|
||||||
- const spawnArgs = isNative ? args : [...executableArgs, pathToClaudeCodeExecutable, ...args];
|
- const spawnArgs = isNative ? args : [...executableArgs, pathToClaudeCodeExecutable, ...args];
|
||||||
- this.logForDebugging(isNative ? `Spawning Claude Code native binary: ${pathToClaudeCodeExecutable} ${args.join(" ")}` : `Spawning Claude Code process: ${executable} ${[...executableArgs, pathToClaudeCodeExecutable, ...args].join(" ")}`);
|
- this.logForDebugging(isNative ? `Spawning Claude Code native binary: ${pathToClaudeCodeExecutable} ${args.join(" ")}` : `Spawning Claude Code process: ${executable} ${[...executableArgs, pathToClaudeCodeExecutable, ...args].join(" ")}`);
|
||||||
+ this.logDebug(`Forking Claude Code Node.js process: ${pathToClaudeCodeExecutable} ${args.join(" ")}`);
|
+ this.logForDebugging(`Forking Claude Code Node.js process: ${pathToClaudeCodeExecutable} ${args.join(" ")}`);
|
||||||
const stderrMode = env.DEBUG || stderr ? "pipe" : "ignore";
|
const stderrMode = env.DEBUG || stderr ? "pipe" : "ignore";
|
||||||
- this.child = spawn(spawnCommand, spawnArgs, {
|
- this.child = spawn(spawnCommand, spawnArgs, {
|
||||||
+ this.child = fork(pathToClaudeCodeExecutable, args, {
|
+ this.child = fork(pathToClaudeCodeExecutable, args, {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user