We are currently starting a new project and realized that for some reason, running sanity-codegen on the project using Node 16.13.2 (or 15.14.0) just hangs. This seems to be a very similar issue to #232.
What I did try locally to fix this is adding a then clause that explicitly exits the process at the end of the CLI process fixes the issue.
In cli.ts file, replacing:
cli().catch((e) => {
console.error(e);
process.exit(1);
});
With:
cli().then(() => process.exit(0)).catch((e) => {
console.error(e);
process.exit(1);
});
Fixed the hanging issue. Since the last line of cli() gets correctly printed on the culprit computer, the Promise ends fine and everything, but for some unknown reason the process just remains alive. Seems like something in the code is being kept alive that prevents Node from ending the process properly when its work is done. I have no idea what this would be though.
I was able to reproduce on many different computers this time, and even running sanity-codegen inside Github Actions hangs by using the same Node version.
Running sanity-codegen on Node 12 and 14 works fine without any issue.