Skip to content

Commit

Permalink
Merge pull request #1137 from pulsar-edit/electron-builder-fix-race-c…
Browse files Browse the repository at this point in the history
…ondition-copying-bins

electron-builder: Fix race condition when preparing to copy binaries
  • Loading branch information
DeeDeeG authored Nov 19, 2024
2 parents ebde801 + ac18e75 commit 39a4a4c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion script/electron-builder.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const path = require('path')
const normalizePackageData = require('normalize-package-data');
const fs = require("fs/promises");
const {mkdirSync} = require("fs");
const generateMetadata = require('./generate-metadata-for-builder')
const macBundleDocumentTypes = require("./mac-bundle-document-types.js");

Expand Down Expand Up @@ -289,7 +290,13 @@ async function main() {
config: options
}).then((result) => {
console.log("Built binaries")
fs.mkdir('binaries').catch(() => "")
try {
mkdirSync('binaries', {recursive: true})
} catch (err) {
console.warn("Warning: error encountered when making the 'binaries' dir.")
console.warn("(HINT: If the 'binaries' folder already exists, then this error message is probably fine to ignore!)")
console.warn(err)
}
Promise.all(result.map(r => fs.copyFile(r, path.join('binaries', path.basename(r)))))
}).catch((error) => {
console.error("Error building binaries")
Expand Down

0 comments on commit 39a4a4c

Please sign in to comment.