diff --git a/lib/parseJob.js b/lib/parseJob.js index 45cbe9d..b4be754 100644 --- a/lib/parseJob.js +++ b/lib/parseJob.js @@ -26,6 +26,9 @@ var fs = require('fs'), try { fileContents = fs.readFileSync(path, 'utf-8'); + // Strip trailing null bytes that can appear from filesystem-level padding + // (e.g. Bun runtime file writes on APFS). The PEG parser rejects \0 characters. + fileContents = fileContents.replace(/\0+$/, ''); obj = parser.parse(fileContents); process.send(obj); } catch (e) { diff --git a/lib/pbxProject.js b/lib/pbxProject.js index 1d53a3e..70a9ce6 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -62,6 +62,10 @@ pbxProject.prototype.parse = function(cb) { pbxProject.prototype.parseSync = function() { var file_contents = fs.readFileSync(this.filepath, 'utf-8'); + // Strip trailing null bytes that can appear from filesystem-level padding + // (e.g. Bun runtime file writes on APFS). The PEG parser rejects \0 characters. + file_contents = file_contents.replace(/\0+$/, ''); + this.hash = parser.parse(file_contents); return this; }