Skip to content

Commit

Permalink
feat: add input-range validation for keepAliveTimeout arg
Browse files Browse the repository at this point in the history
  • Loading branch information
Miikis committed Apr 17, 2022
1 parent 5c44f17 commit d26550e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/next/cli/next-start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,16 @@ const nextStart: cliCommand = (argv) => {
port = 0
}

const keepAliveTimeout: number | undefined = args['--keepAliveTimeout']
const keepAliveTimeoutArg: number | undefined = args['--keepAliveTimeout']
let keepAliveTimeout: number | undefined

if (keepAliveTimeoutArg) {
keepAliveTimeout = Math.ceil(keepAliveTimeoutArg)
keepAliveTimeout = Number.isFinite(keepAliveTimeoutArg)
? keepAliveTimeoutArg
: undefined
keepAliveTimeout = keepAliveTimeoutArg < 0 ? 0 : undefined
}

startServer({
dir,
Expand Down

0 comments on commit d26550e

Please sign in to comment.