build: fail patch diff check on subprocess errors (#52392)

This commit is contained in:
cui fliter authored and GitHub committed 2026-07-23 14:32:13 -05:00
1 parent 0c5e210d3c
commit 40c2abea87
1 file changed
+14 -3
+14 -3
View File
@@ -10,8 +10,19 @@ const proc = spawnSync('python3', [patchExportFnPath, configPath, '--dry-run'],
cwd: srcPath
});
// Fail if patch exporting returned 1, e.g dry run failed.
if (proc.status === 1) {
console.log(proc.stderr.toString('utf8'));
if (proc.error) {
console.error(proc.error.message);
process.exit(1);
}
if (proc.signal) {
console.error(`Patch export terminated by signal ${proc.signal}`);
process.exit(1);
}
// Fail if patch exporting failed, e.g. dry run found changes.
if (proc.status !== 0) {
console.log(proc.stdout.toString('utf8'));
console.error(proc.stderr.toString('utf8'));
process.exit(proc.status ?? 1);
}