Skip to content

Conversation

Viggo95
Copy link
Contributor

@Viggo95 Viggo95 commented Oct 12, 2021

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Underlying tools
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Other information

1.background

We need to execute ctrl +c twice to stop the yarn serve

This is unbearable for developers

image

2.reproduction repo

vue-cli-5-mini-repo


3.webpack-dev-server issue


4.solutions

Usually Ctrl-C is interpreted as a SIGINT signal, And the termination of a process is interpreted as a SIGTERM signal

So we need to exit the child process when these two signals are thrown

image




@Viggo95
Copy link
Contributor Author

Viggo95 commented Oct 12, 2021

@sodatea
Don't mean to interrupt ⛄. If you have time, take a look at this pr and give some feedback💡

We are currently using vue cli5 in our company and there is a lot of questions on this issue

@haoqunjiang
Copy link
Member

But I've configured setupExitSignals. Doesn't that work?

@Viggo95
Copy link
Contributor Author

Viggo95 commented Oct 13, 2021

But I've configured setupExitSignals. Doesn't that work?

I have tried this method and it does not work 👇

image

@Viggo95
Copy link
Contributor Author

Viggo95 commented Oct 13, 2021

You can do a simple test with this project, which will only take about 1min

vue-cli-5-mini-repo

@haoqunjiang
Copy link
Member

Worked on my machine:
image

@haoqunjiang
Copy link
Member

On my machine, Ctrl + C works if the build is finished.
It requires an additional Ctrl + C when the build is in progress because webpack-dev-server tries to gracefully shut down on the first try:
https://github.com/webpack/webpack-dev-server/blob/78c0802a99c27e7ca8aee455c21fa5ac65468db1/lib/Server.js#L1127-L1158

@Viggo95
Copy link
Contributor Author

Viggo95 commented Oct 13, 2021

OK, Thank you for your reply

From the feedback I've gotten so far, All users in 5.0.0-beta.3 have this feedback, users in 5.0.0-beta.5 version and MacOS 10 still have this issue

Using a external keyboard or not can also make some difference

I would using patch-packages to solve this problem within our company

@CarterLi
Copy link

CarterLi commented Nov 3, 2021

Can you please merge this ASAP? It's really annoy.

And if you kill -9 the node process, terminal cursor disappear.

@haoqunjiang
Copy link
Member

haoqunjiang commented Nov 3, 2021

Please first provide a reproduction that I can reproduce the issue with.

@haoqunjiang
Copy link
Member

I think I may have found the actual cause of this issue:
https://github.com/yarnpkg/yarn/releases/tag/v1.22.11

This version fixes a problem where Yarn wasn't forwarding SIGTERM to the binary spawned via yarnPath

Please make sure you are using yarn > 1.22.11

@thiagodebastos
Copy link

thiagodebastos commented Dec 13, 2021

I think I may have found the actual cause of this issue: https://github.com/yarnpkg/yarn/releases/tag/v1.22.11

This version fixes a problem where Yarn wasn't forwarding SIGTERM to the binary spawned via yarnPath

Please make sure you are using yarn > 1.22.11

It can't be yarn, I get this issue when using npm 7.20.3 on Ubuntu in WSL2.

@eleven-net-cn
Copy link

eleven-net-cn commented Aug 8, 2022

I have the same question, eg:

Kapture 2022-08-08 at 11 45 17

As can be seen in the recorded figure, Pressing Control + C for the first time will not exit immediately. Although the program has been terminated, the terminal will not exit the program until pressing Control + C for the second time.

yarn v1.22.19
MacOS Monterey

It seems that it only appears when there are a large number of modules, and a simple demo will not reappear.

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