Skip to content

Error: spawnSync /bin/sh ENOBUFS #59

@pipopotamasu

Description

@pipopotamasu

I encountered Error: spawnSync /bin/sh ENOBUFS error when executing code-complexity. This is the error output.

node:internal/errors:932
  const err = new Error(message);
              ^
Error: Command failed: code-complexity . --since=2022-08-08 --format=json
<ref *1> Error: spawnSync /bin/sh ENOBUFS
    at Object.spawnSync (node:internal/child_process:1124:20)
    at spawnSync (node:child_process:876:24)
    at execSync (node:child_process:957:15)
    at GitHistory.executeGitLogCommand (/builds/developers/test-repo/node_modules/code-complexity/dist/src/lib/githistory/githistory.js:58:50)
    at GitHistory.buildHistory (/builds/developers/test-repo/node_modules/code-complexity/dist/src/lib/githistory/githistory.js:40:29)
    at new GitHistory (/builds/developers/test-repo/node_modules/code-complexity/dist/src/lib/githistory/githistory.js:16:29)
    at GitHistory.build (/builds/developers/test-repo/node_modules/code-complexity/dist/src/lib/githistory/githistory.js:12:16)
    at Statistics.compute (/builds/developers/test-repo/node_modules/code-complexity/dist/src/lib/statistics/statistics.js:14:49)
    at main (/builds/developers/test-repo/node_modules/code-complexity/dist/src/io/index.js:13:44) {
  errno: -105,
  code: 'ENOBUFS',
  syscall: 'spawnSync /bin/sh',
  path: '/bin/sh',
  spawnargs: [
    '-c',
    `git -C . log --follow --format='' --name-only --since="2022-08-08" '*'`
  ],

...

It looks like the buffer size is not enough when executing git log. Based on the assumption, this error can happen if the output of git log is too large.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnext-releaseFix or feature will be available in the very next version release.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions