Skip to content

Commit

Permalink
fix(mac): make tempFile unique for each call to getProvisioningProfil…
Browse files Browse the repository at this point in the history
…eAsync (#4269)

When building multiple targets on macOS, getProvisioningProfileAsync would create a temporary
plist file that was shared between targets. However this method also unlinked the file it created
causing the other target, which was running in parallel to crash. This fix makes the temporary
file name unique for each call to getProvisioningProfileAsync so when the method unlinks the
file, it doesn't cause other targets building in parallel to fail.

fixes #4204
  • Loading branch information
UzEE authored and develar committed Oct 22, 2019
1 parent 965392b commit f858f9e
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,13 @@ var getProvisioningProfileAsync = module.exports.getProvisioningProfileAsync = f

return execFileAsync('security', securityArgs)
.then(async function (result) {
// make filename unique so it doesn't create issues with parallel method calls
const timestamp = process.hrtime.bigint
? process.hrtime.bigint().toString()
: process.hrtime().join('')

// todo read directly
const tempFile = path.join(os.tmpdir(), `${require('crypto').createHash('sha1').update(filePath).digest("hex")}.plist`)
const tempFile = path.join(os.tmpdir(), `${require('crypto').createHash('sha1').update(filePath).update(timestamp).digest('hex')}.plist`)
await fs.outputFile(tempFile, result)
const plistContent = await executeAppBuilderAsJson(["decode-plist", "-f", tempFile])
await fs.unlink(tempFile)
Expand Down

0 comments on commit f858f9e

Please sign in to comment.