Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/ready-ravens-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-codegen/cli': patch
---

fix(graphql-codegen-cli): Don't hang when 0 CPUs are found

Fixes generation when 0 CPUs are returned by os.cpus(), which occurs in sandbox environments.
2 changes: 1 addition & 1 deletion packages/graphql-codegen-cli/src/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ export async function executeCodegen(
};
});

return task.newListr(generateTasks, { concurrent: cpus().length });
return task.newListr(generateTasks, { concurrent: cpus().length || 1 });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point about having unit tests here may not be useful 🤔
Even if we mocked cpus(), I can't think of a good (or meaningful) way to assert that it works.

Agree with merging this first, thank you!

},
},
],
Expand Down