FredKSchott / snowpack

ESM-powered frontend build tool. Instant, lightweight, unbundled development. ✌️
https://www.snowpack.dev
MIT License
19.48k stars 921 forks source link

πŸ› BUG: Can't quit dev server Win11 #3900

Closed pettijohn closed 1 year ago

pettijohn commented 2 years ago

Quick checklist

What package manager are you using?

esnext

What operating system are you using?

Docker on Ubuntu on Windows 11 WSL2

Describe the bug

I cannot kill the dev server. I have tried CTRL+C repeatedly, CTRL+Break, and everything else I can think of. I've tried using Windows Terminal and Windows Console Host to start the dev server. I don't have snowpack or node installed locally and am running in a Docker container. CTRL+Break seems to kill Bash.

docker run -it -v=${PWD}:/app -p=8080:8080 snowpack dev

[24:10:30] [snowpack] Ready!
[24:10:30] [snowpack] Server started in 11ms.
[24:10:30] [snowpack] Local: http://localhost:8080
[24:10:30] [snowpack] Network: http://172.17.0.2:8080
⠏ watching for file changes...

I briefly see ^C when I hit the key combo.

snowpack --version
[24:15:59] [snowpack] 3.8.8

Dockerfile:

FROM node

WORKDIR /app
RUN npm install -g typescript 
RUN npm install -g snowpack

VOLUME [ "/app" ]
ENTRYPOINT [ "snowpack" ]

Steps to reproduce

  1. Have a system running Ubuntu on WSL2 on Win11 with Docker installed in Ubuntu (not Docker Desktop on Windows)
  2. docker build . -t snowpack with Dockerfile above
  3. docker run -it -v=${PWD}:/app -p=8080:8080 snowpack dev
  4. CTRL+C, repeatedly
  5. Never quits

Link to minimal reproducible example (optional)

No response

pettijohn commented 2 years ago

The best way I've found to quit the dev server is to run docker stop <container id> or docker kill <container id>. Interestingly, docker kill --signal=SIGINT <container id> doesn't work even though I think that's the right signal per this old issue https://github.com/withastro/snowpack/pull/380

pettijohn commented 1 year ago

Needed to run docker run with --init to properly handle CTRL+C and other signals