mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-17 22:05:50 +00:00
fix: daemon 子进程 spawn 跨平台修复 + CliLaunchSpec 集中化重构
- 新建 src/utils/cliLaunch.ts: 集中化 CLI 子进程启动层
- buildCliLaunch(): 标准化启动规范(execArgv snapshot + bundled mode 检测)
- spawnCli(): 统一 spawn(自动 windowsHide)
- quoteCliLaunch(): tmux shell 引用
- 修复 --daemon-worker=kind 等号格式解析(cli.tsx)
- 修复 daemon/bg fast path 缺少 setShellIfWindows()(Windows git-bash 发现)
- 修复 checkPathExists 用 execSync('dir') 改为 existsSync(消除 cmd.exe 弹窗)
- 修复 CLAUDE_CODE_GIT_BASH_PATH env 传播给子进程
- 7 个 spawn 站点迁移到 CliLaunchSpec
- BgEngine 接口新增 supportsInteractiveInput capability
- daemon bg 无 -p 时 detached 引擎给出清晰错误提示
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { spawn, type ChildProcess } from 'child_process';
|
||||
import { type ChildProcess } from 'child_process';
|
||||
import { resolve } from 'path';
|
||||
import * as React from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
@@ -10,6 +10,7 @@ import { ListItem } from '../../components/design-system/ListItem.js';
|
||||
import { useRegisterOverlay } from '../../context/overlayContext.js';
|
||||
import { Box, Text } from '@anthropic/ink';
|
||||
import { useKeybindings } from '../../keybindings/useKeybinding.js';
|
||||
import { buildCliLaunch, spawnCli } from '../../utils/cliLaunch.js';
|
||||
import type { ToolUseContext } from '../../Tool.js';
|
||||
import type { LocalJSXCommandContext, LocalJSXCommandOnDone } from '../../types/command.js';
|
||||
import { errorMessage } from '../../utils/errors.js';
|
||||
@@ -202,9 +203,9 @@ async function checkPrerequisites(): Promise<string | null> {
|
||||
function startDaemon(): void {
|
||||
const dir = resolve('.');
|
||||
|
||||
const execArgs = [...process.execArgv, process.argv[1]!, 'daemon', 'start', `--dir=${dir}`];
|
||||
const launch = buildCliLaunch(['daemon', 'start', `--dir=${dir}`]);
|
||||
|
||||
const child = spawn(process.execPath, execArgs, {
|
||||
const child = spawnCli(launch, {
|
||||
cwd: dir,
|
||||
stdio: ['ignore', 'pipe', 'pipe'],
|
||||
detached: false,
|
||||
|
||||
Reference in New Issue
Block a user