MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / captureSpawnEnv

Function captureSpawnEnv

packages/agent-core/test/tools/bash-env.test.ts:34–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32const signal = new AbortController().signal;
33
34async function captureSpawnEnv(): Promise<Record<string, string>> {
35 const execWithEnv = vi.fn().mockResolvedValue(fakeProcess());
36 const tool = new BashTool(
37 createFakeKaos({ execWithEnv, osEnv: posixEnv }),
38 '/workspace',
39 createBackgroundManager().manager,
40 );
41 await executeTool(tool, {
42 turnId: '0',
43 toolCallId: 'tc_env',
44 args: { command: 'true', timeout: 1000 },
45 signal,
46 });
47 return execWithEnv.mock.calls[0]?.[1] as Record<string, string>;
48}
49
50describe('BashTool noninteractive env semantics', () => {
51 it('preserves an existing GIT_TERMINAL_PROMPT from the ambient env', async () => {

Callers 1

bash-env.test.tsFile · 0.85

Calls 4

createFakeKaosFunction · 0.90
createBackgroundManagerFunction · 0.90
executeToolFunction · 0.90
fakeProcessFunction · 0.70

Tested by

no test coverage detected