From d8e359ae9ab393e6a5deda9be02799554be61e2a Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 30 Mar 2026 15:30:11 +0200 Subject: [PATCH] Await fs.rename in zipIPA and narrow unlink error handling --- index.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/index.ts b/index.ts index d8cce57..114934b 100644 --- a/index.ts +++ b/index.ts @@ -854,16 +854,18 @@ class Applesign { } const ipaOut = getOutputPath(this.config.tempdir, this.config.outfile!); try { - fs.unlinkSync(ipaOut); // await for it - } catch (e) { - /* do nothing */ + await fs.unlink(ipaOut); + } catch (err: any) { + if (err?.code !== "ENOENT") { + throw err; + } } this.events.emit("message", "Zipifying into " + ipaOut + " ..."); const rootFolder = this.config.payloadOnly ? "Payload" : "."; await tools.zip(this.config.tempdir, ipaOut, rootFolder); if (this.config.replaceipa) { this.events.emit("message", "mv into " + ipaIn); - fs.rename(ipaOut, ipaIn); + await fs.rename(ipaOut, ipaIn); } }