Skip to content

Commit

Permalink
Fix race condition in --insert *.dylib
Browse files Browse the repository at this point in the history
  • Loading branch information
trufae committed Sep 22, 2016
1 parent 98f5062 commit 5363b62
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions session.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,15 @@ function insertLibrary (config, cb) {
}
const outputLib = path.join(appDir, 'Frameworks', libraryName);
try {
fs.createReadStream(targetLib).pipe(fs.createWriteStream(outputLib));
const writeStream = fs.createWriteStream(outputLib);
writeStream.on('finish', () => {
const insertedLibraryName = '@rpath/' + path.basename(targetLib);
return tools.insertLibrary(insertedLibraryName, config.appbin, outputLib, cb);
});
fs.createReadStream(targetLib).pipe(writeStream);
} catch (e) {
console.error(e);
}
const insertedLibraryName = '@rpath/' + path.basename(targetLib);
return tools.insertLibrary(insertedLibraryName, config.appbin, outputLib, cb);
}

function getResignedFilename (path) {
Expand Down

0 comments on commit 5363b62

Please sign in to comment.