Skip to content

Commit

Permalink
fix: avoid directly importing availableParallelism from os
Browse files Browse the repository at this point in the history
it is too new!
  • Loading branch information
pi0 committed Aug 2, 2023
1 parent 21ecc5b commit bdd8771
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/_cert.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Rewrite from https://github.com/Subash/mkcert 1.5.1 (MIT)
import { promisify } from "node:util";
import { availableParallelism, cpus } from "node:os";
import nodeOS from "node:os";
import { promises as fs } from "node:fs";
import type nodeForge from "node-forge";
import forge from "node-forge";
Expand Down Expand Up @@ -294,7 +294,9 @@ async function generateKeyPair(bits = 2048): Promise<forge.pki.KeyPair> {
);
return await _generateKeyPair({
bits,
workers: availableParallelism ? availableParallelism() : cpus().length,
workers: nodeOS.availableParallelism
? nodeOS.availableParallelism()
: nodeOS.cpus().length,
});
}

Expand Down

0 comments on commit bdd8771

Please sign in to comment.