Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nest start doesn't wait for app to exit #1615

Closed
2 of 4 tasks
WiseBird opened this issue Apr 18, 2022 · 1 comment
Closed
2 of 4 tasks

nest start doesn't wait for app to exit #1615

WiseBird opened this issue Apr 18, 2022 · 1 comment

Comments

@WiseBird
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

CLI doesn't wait for the application to exit.
In the case of closing CLI with Ctrl-C, it results in the application still running (and logging messages) while control is returned to the terminal.
image

In the case of the watch command, the application is restarted before the previous instance is stopped, which results in address already in use error.
image

Minimum reproduction code

https://github.com/WiseBird/nestjs-shutdown

Steps to reproduce

From a code perspective, the app should have an async shutdown hook, e.g.:
image

The simplest steps:

  1. npm start
  2. Ctrl+C

could be also reproduced with start:dev command:

  1. npm run start:dev
  2. Make a change in the code

Expected behavior

CLI waits for the application to exit before exiting itself or restarting the app.

Package version

8.2.5

NestJS version

8.4.4

Node.js version

16.10.

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

The problem relates to #1487, not sure if it can be considered a duplicate as this one is not about http server but purely CLI issue.

@micalevisk
Copy link
Member

duplicate of #1614

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

No branches or pull requests

2 participants