### Bug description

Suppose you've got the following in `test.qmd`:
````
---
title: Test
jupyter:
  jupytext:
    formats: 'ipynb,md'
  kernelspec:
    display_name: Python 3 (ipykernel)
    language: python
    name: python3
---

```{python}
while True:
    pass
```
````
and then you, ill-advisedly, run
```
quarto preview test.qmd
```
After the machine spins for a bit you realize your error and hit `^C`. This kills quarto but *not* (apparently, on my machine;
`Debian 6.1.7-1 (2023-01-18) x86_64 GNU/Linux`) the python kernel (which is still visible in `top`, for instance).

Changing the cell to 
````
```{python}
while True:
    break
```
````
instead and re-running `quarto preview test.qmd` does not get python out of its infinite loop; neither does doing the same change without having killed quarto. I haven't found a way to kill the python kernel besides finding the PID from top and killing it manually.

Is there a better way to deal with this (besides `daemon: false` in the config)?

ps. I can deal with this with only minor annoyance; but this seems major - I'd not want to assign my stats class to use quarto knowing they could well hit this, for instance.

```
$ quarto check

[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.1: OK
      Dart Sass version 1.55.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.3.313
      Path: /opt/quarto/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.11.2
      Path: /usr/bin/python3
      Jupyter: 4.12.0
      Kernels: ir, python3

(\) Checking Jupyter engine render....0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.2.2
      Path: /usr/lib/R
      LibPaths:
        - /home/peter/R
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      knitr: 1.36
      rmarkdown: 2.21

[✓] Checking Knitr engine render......OK
```

### Checklist

- [X] Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- [X] Please [format your issue](https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us) so it is easier for us to read the bug report.
- [X] Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [X] Please document the operating system you're running. If on Linux, please provide the specific distribution.
- [X] Please provide the output of `quarto check` so we know which version of quarto and its dependencies you're running.
cscheid
2023-04-10T04:31:53Z
petrelharp
enhancement
v1.5
open
how to kill kernel for preview with an infinite loop?
https://github.com/quarto-dev/quarto-cli/issues/5141