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 19, 2022
1 parent f9387ee commit 48396b9
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 48396b9

Please sign in to comment.