mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: fix patch
This commit is contained in:
1 file changed
+5
-4
@@ -15,16 +15,17 @@ export function register(cli: CAC) {
|
||||
return;
|
||||
}
|
||||
logger.info('Patching %s', mod);
|
||||
const res = await superagent.get(patch);
|
||||
const res = await superagent.get(patch).responseType('arraybuffer');
|
||||
logger.info('Downloaded patch');
|
||||
for (let i = 0; i <= 100; i++) {
|
||||
const fp = path.join(path.dirname(mod), `${mod}.${i}.patch`);
|
||||
const fp = path.join(path.dirname(mod), `${path.basename(mod)}.${i}.patch`);
|
||||
if (fs.existsSync(fp)) continue;
|
||||
patch = fp;
|
||||
break;
|
||||
}
|
||||
await fs.writeFile(patch, res.text);
|
||||
child.execSync(`patch ${mod} -o ${mod} < ${patch}`);
|
||||
await fs.writeFile(patch, res.body);
|
||||
child.execSync(`patch ${mod} -o ${mod}.tmp < ${patch}`);
|
||||
await fs.move(`${mod}.tmp`, mod);
|
||||
logger.info('Patched %s', mod);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user