Skip to content

Commit 9e79733

Browse files
radaretrufae
authored andcommitted
Await fs.rename in zipIPA and narrow unlink error handling
1 parent e08118a commit 9e79733

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -855,16 +855,18 @@ class Applesign {
855855
}
856856
const ipaOut = getOutputPath(this.config.tempdir, this.config.outfile!);
857857
try {
858-
fs.unlinkSync(ipaOut); // await for it
859-
} catch (e) {
860-
/* do nothing */
858+
await fs.unlink(ipaOut);
859+
} catch (err: any) {
860+
if (err?.code !== "ENOENT") {
861+
throw err;
862+
}
861863
}
862864
this.events.emit("message", "Zipifying into " + ipaOut + " ...");
863865
const rootFolder = this.config.payloadOnly ? "Payload" : ".";
864866
await tools.zip(this.config.tempdir, ipaOut, rootFolder);
865867
if (this.config.replaceipa) {
866868
this.events.emit("message", "mv into " + ipaIn);
867-
fs.rename(ipaOut, ipaIn);
869+
await fs.rename(ipaOut, ipaIn);
868870
}
869871
}
870872

0 commit comments

Comments
 (0)