diff --git a/packages/serve-cli/src/cli.ts b/packages/serve-cli/src/cli.ts index 834c028f95518..0a62c62da4fd0 100644 --- a/packages/serve-cli/src/cli.ts +++ b/packages/serve-cli/src/cli.ts @@ -169,7 +169,7 @@ export type AddCommand = (ctx: CLIContext, cli: CLI) => void; // we dont use `Option.default()` in the command definitions because we want the CLI options to // override the config file (with option defaults, config file will always be overwritten) -const maxAvailableFork = Math.max(availableParallelism() - 1, 1); +const maxAvailableFork = availableParallelism(); export const defaultOptions = { fork: process.env.NODE_ENV === 'production' ? maxAvailableFork : 1, host: @@ -196,10 +196,7 @@ let cli = new Command() .env('FORK') .argParser(v => { const count = parseInt(v); - if (isNaN(count)) { - throw new InvalidArgumentError('not a number.'); - } - if (count > maxAvailableFork) { + if (isNaN(count) || count > maxAvailableFork) { return maxAvailableFork; } return count;