Angular-cli: Unable to cancel ng serve until it finishes running

Created on 2 Dec 2020  路  4Comments  路  Source: angular/angular-cli

馃悶 Bug report

Command (mark with an x)


  • [ ] new
  • [ ] build
  • [x] serve
  • [ ] test
  • [ ] e2e
  • [ ] generate
  • [ ] add
  • [ ] update
  • [ ] lint
  • [ ] extract-i18n
  • [ ] run
  • [ ] config
  • [ ] help
  • [ ] version
  • [ ] doc

Is this a regression?

Yes, it worked ok with v10

Description

If I run ng serve and hit ctrl + c to cancel, it doesn't do anything until it finishes the build phase it is currently on. Our app is pretty big and takes about 2 minutes to finish building so it's pretty annoying to have to wait for it to finish to cancel. I believe this is caused by the new terminal output introduced in v11 as it wasn't an issue with previous versions of angular.

You can see the issue in the screenshot here, I was hitting ctrl + c repeatedly for over a minute until it finally let me cancel
image

馃敩 Minimal Reproduction

It's kind of tricky to make a reproduction for this, but if you open any large app where Generating browser application bundles... will take a while and hit ctrl + c to cance, nothing will happen until the build step completes.

馃敟 Exception or Error

N/A

馃實 Your Environment


Angular CLI: 11.0.2
Node: 14.13.1
OS: darwin x64

Angular: 11.0.2
... animations, cli, common, compiler, compiler-cli, core
... elements, forms, language-service, localize
... platform-browser, platform-browser-dynamic, router
... service-worker
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1100.2
@angular-devkit/build-angular   0.1100.2
@angular-devkit/core            11.0.2
@angular-devkit/schematics      11.0.2
@angular/cdk                    9.0.1
@angular/google-maps            11.0.1
@schematics/angular             11.0.2
@schematics/update              0.1100.2
rxjs                            6.6.3
typescript                      4.0.5

Anything else relevant?
I tested on a few different terminal apps and the problem happens on all of them

devkibuild-angular medium regression bufix

All 4 comments

@clydin, saw this in the past but I never managed to replicate it locally. Although now I do see a delay when using CTRL+C.

I think I know what is going on. I鈥檒l take a look at this tomorrow.

The fix in https://github.com/angular/angular-cli/pull/19540 should do it. Would be great if you can confirm that it does the trick for you.

Yes that works great, thank you! Patched my node_modules with the change and it allowed me to cancel any time. Thanks for the quick response! 馃槃

Thanks for the confirmation.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JanStureNielsen picture JanStureNielsen  路  3Comments

hareeshav picture hareeshav  路  3Comments

brtnshrdr picture brtnshrdr  路  3Comments

MateenKadwaikar picture MateenKadwaikar  路  3Comments

jbeckton picture jbeckton  路  3Comments