Skip to content

[1.7.0] ng serve not properly killed on CTRL+C with yarn/npm #9647

Description

@victornoel

Versions

Angular CLI: 1.7.0
Node: 6.9.5
OS: linux x64
Angular: 5.2.5
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.7.0
@angular-devkit/build-optimizer: 0.3.1
@angular-devkit/core: 0.3.1
@angular-devkit/schematics: 0.3.1
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.0
@schematics/angular: 0.3.1
@schematics/package-update: 0.3.1
typescript: 2.5.3
webpack: 3.11.0

Repro steps

  • create project with ng new
  • run yarn start or npm start
  • hit ctrl-c

Observed behavior

the ng process is still running

Desired behavior

The ng process should be stopped.
It is stopped with v1.6.8 but not with v1.7.0

Mention any other details that might be useful (optional)

It happens also with node 8, with yarn or npm. The version of those did not change: only switching between v1.6.8 and v1.7.0 exhibits the problem.

When running ng serve by hand, surprisingly hitting ctrl+c does not stop the ng process, but you have to hit ctrl+c again for it to happen!

Activity

  1. victornoel commented on Feb 16, 2018

    @victornoel
    Author

    Note that the problem happens both on windows and linux

  2. dottodot commented on Feb 16, 2018

    @dottodot

    I'm seeing this too. Having to resort to running sudo lsof -t -i tcp:4200 | xargs kill -9 before serving again

  3. jtsom commented on Feb 16, 2018

    @jtsom
    Contributor

    Also appears on OS X. two Control-C to kill the server.

  4. switch120 commented on Feb 16, 2018

    @switch120

    Oh my god this is the worst - same issue here. Anyone find a fix? So aggravating. Running CLI v1.6.8, Ubuntu 16.04LTS vagrant VM.

  5. MattMorrisDev commented on Feb 16, 2018

    @MattMorrisDev

    I see this too, but it only happens when I use yarn to run my npm scripts. (OS X btw)

  6. athulreji commented on Feb 17, 2018

    @athulreji

    Try ctrl + shift + c

  7. switch120 commented on Feb 17, 2018

    @switch120

    Yeah I saw that on a SO answer and tried several variations, including ctrl + Z, etc. This was never an issue prior to updating from Angular CLI 1.5 to 1.6.8. Regular 'ol ctrl + c would stop everything. Now it just drops back to a command prompt and leaves 2 processes running. One for ng and one for an sh ng ... that runs the actual webserver. It's just aggravating. I ended up adding another command to my package.json called kill and set it to sudo lsof -t -i tcp:443 | xargs kill -s 9 (my app runs on SSL, sub 443 for whatever port you're using). Still would be great to find a way to make this work like it used to.

  8. added a commit that references this issue on Feb 17, 2018
    2b4d793
  9. sinedsem commented on Feb 19, 2018

    @sinedsem

    +1
    Very annoying!
    Thanks God I noticed this before upgrading my main project.

  10. added a commit that references this issue on Feb 19, 2018
    072da7a
  11. devoto13 commented on Feb 19, 2018

    @devoto13
    Contributor

    To temporary workaround this issue you can remove line 382 from node_modules/@ngtools/webpack/src/angular_compiler_plugin.js. This line should have process.once('SIGINT', handleParentProcessExit);.

  12. added 3 commits that reference this issue on Feb 19, 2018
    111c78d
    c77fa22
    49bdbcf
  13. 4 remaining items

  14. esanzgar commented on Feb 20, 2018

    @esanzgar

    killall ng

  15. added a commit that references this issue on Feb 21, 2018
    2be8cad
  16. added a commit that references this issue on Feb 21, 2018
    78d48be
  17. switch120 commented on Feb 21, 2018

    @switch120

    fwiw ... #9668 refers to this issue using ng serve --aot. I'm seeing this happen with just a regular ng serve and wanted to make sure that was accounted for in the other thread. Thanks!

  18. devoto13 commented on Feb 21, 2018

    @devoto13
    Contributor

    @switch120 It should fix it without --aot as well.

  19. added a commit that references this issue on Feb 22, 2018
    c5ec36e
  20. added a commit that references this issue on Apr 23, 2018
    e3766ee
  21. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  22. locked and limited conversation to collaborators on Sep 7, 2019
  23. added a commit that references this issue on May 29, 2026
    66ce9d5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions