feat: demo-pmd 样本工程入库 + Windows spawn cmd EINVAL 修复 + 实测报告清理
- data/demo-pmd 全量入库(26 源文件 + pom/mvnw/lib/reports),.gitignore 排除 target/ - 归档 demo-pmd 实测覆盖率报告(279/279 全覆盖)至 reports/ - 删除 4 份覆盖率报告中的后续建议/实测进度总览(全部实测已收官) - 修复 Windows spawn .cmd/.bat EINVAL(auxClasspath.ts 经 cmd.exe /d /s /c 间接执行)
This commit is contained in:
@@ -157,6 +157,13 @@ export class AuxClasspathResolver {
|
||||
return systemName;
|
||||
}
|
||||
|
||||
private quoteCmdArg(arg: string): string {
|
||||
if (/^[\w.,:=/@%\\+-]+$/.test(arg)) {
|
||||
return arg;
|
||||
}
|
||||
return `"${arg.replace(/"/g, '""')}"`;
|
||||
}
|
||||
|
||||
private lastNonEmptyLine(output: string): string {
|
||||
const lines = output.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0);
|
||||
return lines.length > 0 ? lines[lines.length - 1] : '';
|
||||
@@ -174,7 +181,16 @@ export class AuxClasspathResolver {
|
||||
reject(new Error(`Command timed out after ${BUILD_TIMEOUT}ms: ${cmd}`));
|
||||
}, BUILD_TIMEOUT);
|
||||
try {
|
||||
proc = spawn(cmd, args, { cwd, windowsHide: true });
|
||||
if (isWindows() && /\.(cmd|bat)$/i.test(cmd)) {
|
||||
const inner = `${this.quoteCmdArg(cmd)} ${args.map((arg) => this.quoteCmdArg(arg)).join(' ')}`;
|
||||
proc = spawn('cmd.exe', ['/d', '/s', '/c', `"${inner}"`], {
|
||||
cwd,
|
||||
windowsHide: true,
|
||||
windowsVerbatimArguments: true,
|
||||
});
|
||||
} else {
|
||||
proc = spawn(cmd, args, { cwd, windowsHide: true });
|
||||
}
|
||||
} catch (err) {
|
||||
clearTimeout(timer);
|
||||
reject(err);
|
||||
|
||||
Reference in New Issue
Block a user