Skip to content

Commit

Permalink
fix: spawn buffer size (#236)
Browse files Browse the repository at this point in the history
* fix: spawn buffer size

* refactor: use Boolean identity method
  • Loading branch information
scolladon authored Jan 5, 2022
1 parent 11be03a commit 9944c43
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/utils/fileGitDiff.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = (filePath, config) => {
'--',
filePath,
],
{ cwd: config.repo, encoding: gc.UTF8_ENCODING }
{ cwd: config.repo, encoding: gc.UTF8_ENCODING, maxBuffer: 1024 * 10240 }
)

return cpUtils.treatEOL(diff)
Expand Down
18 changes: 12 additions & 6 deletions src/utils/repoGitDiff.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,19 @@ class RepoGitDiff {
constructor(config, metadata) {
this.config = config
this.metadata = metadata
this.spawnConfig = {
cwd: this.config.repo,
encoding: gc.UTF8_ENCODING,
maxBuffer: 1024 * 10240,
}
}

getIncludedFiles() {
const { stdout: ls } = childProcess.spawnSync('git', [...allFilesParams], {
cwd: this.config.repo,
encoding: gc.UTF8_ENCODING,
})
const { stdout: ls } = childProcess.spawnSync(
'git',
[...allFilesParams],
this.spawnConfig
)
return this._addIncludes(cpUtils.treatDataFromSpawn(ls))
}

Expand All @@ -51,7 +57,7 @@ class RepoGitDiff {
this.config.to,
this.config.source,
],
{ cwd: this.config.repo, encoding: gc.UTF8_ENCODING }
this.spawnConfig
)
return this._treatResult(cpUtils.treatDataFromSpawn(diff))
}
Expand Down Expand Up @@ -99,7 +105,7 @@ class RepoGitDiff {
.readFileSync(obj.include)
.toString()
.split(os.EOL)
.filter(i => i)
.filter(Boolean)
).map(include => `${obj.prefix} ${include}`)
: []
})
Expand Down

0 comments on commit 9944c43

Please sign in to comment.