Skip to content

fix: gracefully handle missing --delay argument#2273

Open
AkaHarshit wants to merge 1 commit into
remy:mainfrom
AkaHarshit:fix/graceful-delay-arg
Open

fix: gracefully handle missing --delay argument#2273
AkaHarshit wants to merge 1 commit into
remy:mainfrom
AkaHarshit:fix/graceful-delay-arg

Conversation

@AkaHarshit

Copy link
Copy Markdown

Problem

When running nodemon --delay without providing an argument, the CLI parser attempts to read the missing argument and inadvertently passes undefined to parseDelay(). This results in the process crashing with an unhandled exception: TypeError: Cannot read properties of undefined (reading 'match').

Solution

Updated the parseDelay function in lib/cli/parse.js with a type guard to ensure the value is a string before evaluating .match(). If the argument is missing, the delay safely defaults to 0 milliseconds instead of crashing the process.

Testing

  • Added a new unit test in test/cli/parse.test.js to ensure the cli.parse('--delay') edge case is fully covered and behaves gracefully without throwing.
  • Ran the full npm test suite to avoid regressions.
  • Performed manual testing node ./bin/nodemon.js --delay and verified that the process correctly initializes without exceptions.

Fixes an unhandled exception where running `nodemon --delay` without providing a time value causes the node process to crash with a TypeError.
@netlify

netlify Bot commented Mar 19, 2026

Copy link
Copy Markdown

Deploy Preview for nodemon ready!

Name Link
🔨 Latest commit 5cf687c
🔍 Latest deploy log https://app.netlify.com/projects/nodemon/deploys/69bc422fc94ff00008f4c4e2
😎 Deploy Preview https://deploy-preview-2273--nodemon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant