惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
Martin Fowler
Martin Fowler
博客园_首页
量子位
T
Tailwind CSS Blog
博客园 - Franky
G
Google Developers Blog
D
DataBreaches.Net
Vercel News
Vercel News
B
Blog
Recent Announcements
Recent Announcements
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
爱范儿
爱范儿
博客园 - 【当耐特】
The Cloudflare Blog
H
Help Net Security
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
C
Check Point Blog
有赞技术团队
有赞技术团队
Microsoft Security Blog
Microsoft Security Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(test): kill openclaw test process groups · openclaw/o...
vincentkoc · 2026-06-18 · via Recent Commits to openclaw:main

@@ -73,6 +73,8 @@ type BoundedStringLog = string[] & {

7373

truncated?: boolean;

7474

};

757576+

type OpenClawTestChildProcess = Pick<ChildProcessWithoutNullStreams, "kill" | "pid">;

77+7678

function createBoundedStringLog(): string[] {

7779

const log = [] as BoundedStringLog;

7880

log.byteLength = 0;

@@ -152,6 +154,7 @@ async function prepareGatewayEntrypoint(cwd: string): Promise<string[]> {

152154

cwd,

153155

env: { ...process.env, VITEST: "1" },

154156

stdio: ["ignore", "pipe", "pipe"],

157+

detached: shouldUseOpenClawTestProcessGroup(),

155158

});

156159

child.stdout?.setEncoding("utf8");

157160

child.stderr?.setEncoding("utf8");

@@ -167,7 +170,7 @@ async function prepareGatewayEntrypoint(cwd: string): Promise<string[]> {

167170

]);

168171169172

if (completed === null) {

170-

child.kill("SIGKILL");

173+

signalOpenClawTestProcess(child, "SIGKILL");

171174

throw new Error(`timeout preparing gateway entrypoint\n${formatLogs(stdout, stderr)}`);

172175

}

173176

if (completed.code !== 0) {

@@ -401,6 +404,7 @@ export async function createOpenClawTestInstance(

401404

cwd,

402405

env,

403406

stdio: ["ignore", "pipe", "pipe"],

407+

detached: shouldUseOpenClawTestProcessGroup(),

404408

},

405409

);

406410

@@ -428,7 +432,7 @@ export async function createOpenClawTestInstance(

428432

}

429433

if (!hasChildExited(child) && !child.killed) {

430434

try {

431-

child.kill("SIGTERM");

435+

signalOpenClawTestProcess(child, "SIGTERM");

432436

} catch {

433437

// ignore

434438

}

@@ -439,7 +443,7 @@ export async function createOpenClawTestInstance(

439443

);

440444

if (!exited && !hasChildExited(child) && !child.killed) {

441445

try {

442-

child.kill("SIGKILL");

446+

signalOpenClawTestProcess(child, "SIGKILL");

443447

} catch {

444448

// ignore

445449

}

@@ -479,6 +483,7 @@ async function runCommand(params: {

479483

cwd: params.cwd,

480484

env: params.env,

481485

stdio: ["ignore", "pipe", "pipe"],

486+

detached: shouldUseOpenClawTestProcessGroup(),

482487

});

483488

child.stdout?.setEncoding("utf8");

484489

child.stderr?.setEncoding("utf8");

@@ -493,7 +498,7 @@ async function runCommand(params: {

493498

sleep(params.timeoutMs).then(() => null),

494499

]);

495500

if (completed === null) {

496-

child.kill("SIGKILL");

501+

signalOpenClawTestProcess(child, "SIGKILL");

497502

await waitForGatewayExit(child, GATEWAY_STOP_TIMEOUT_MS);

498503

throw new Error(

499504

`command timed out after ${params.timeoutMs}ms: ${params.args.join(" ")}\n${formatLogs(stdout, stderr)}`,

@@ -506,10 +511,31 @@ async function runCommand(params: {

506511

};

507512

}

508513514+

function shouldUseOpenClawTestProcessGroup(): boolean {

515+

return process.platform !== "win32";

516+

}

517+518+

function signalOpenClawTestProcess(

519+

child: OpenClawTestChildProcess,

520+

signal: NodeJS.Signals,

521+

killProcess: (pid: number, signal: NodeJS.Signals) => boolean = process.kill,

522+

): void {

523+

if (shouldUseOpenClawTestProcessGroup() && typeof child.pid === "number") {

524+

try {

525+

killProcess(-child.pid, signal);

526+

return;

527+

} catch {

528+

// Fall back to the direct child if the process group already exited.

529+

}

530+

}

531+

child.kill(signal);

532+

}

533+509534

export const testing = {

510535

appendLogChunk,

511536

createBoundedStringLog,

512537

formatLogs,

513538

hasChildExited,

539+

signalOpenClawTestProcess,

514540

waitForPortOpen,

515541

};