fix(mcp): strip ANSI/control chars from compose startDiag for JSON safety
Made-with: Cursor
This commit is contained in:
@@ -1273,7 +1273,13 @@ async function ensureServiceUp(uuid: string): Promise<{
|
|||||||
let composeDiag = '';
|
let composeDiag = '';
|
||||||
try {
|
try {
|
||||||
const r = await composeUp('service', uuid, { timeoutMs: 600_000 });
|
const r = await composeUp('service', uuid, { timeoutMs: 600_000 });
|
||||||
composeDiag = (r.stderr || r.stdout).trim().slice(-400);
|
// Strip ANSI / control chars (compose progress output uses \r and
|
||||||
|
// ANSI escapes) so the diag survives JSON serialization cleanly.
|
||||||
|
composeDiag = (r.stderr || r.stdout)
|
||||||
|
.replace(/\x1b\[[0-9;]*[a-zA-Z]/g, '')
|
||||||
|
.replace(/[\x00-\x08\x0B-\x1F]/g, '')
|
||||||
|
.trim()
|
||||||
|
.slice(-400);
|
||||||
if (r.code === 0) {
|
if (r.code === 0) {
|
||||||
return { started: true, startMethod: 'compose-up', diag: '' };
|
return { started: true, startMethod: 'compose-up', diag: '' };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user