-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
beforeDevCommand
is not killed on app exit
#2794
Comments
beforeDevCommand
is not killed on app exit
Gracefully or not, please terminate the darn process :-) I cannot reproduce the behavior reliably. Sometimes the dev server gets shut down, sometimes it keeps running. This is esepcially annoying while debugging: trying to force the app to do something, wondering why the app is acting so strange and then realizing a few minutes later that none of the code changes were actually deployed. |
And as this points to something specific being necessary to trigger this failure in terminating the child process, I believe some |
I couldn't reproduce this one yet, can one of you see if #2883 fixes it? |
@lucasfernog Here's my tauri info for the same issue, I consistently get this bug.
|
I also always got it. ▶ cargo tauri info Operating System - Mac OS, version 12.2.1 X64 Node.js environment Global packages Rust environment App directory structure App |
So this does seem to look like a react issue. I think we should go through and verify other non-"reacty" frameworks and see if its just particular here, or relevant for others. |
It is a general problem, it's just worse with some frameworks/bundlers. For example i have the same problem with vitejs (no matter the frontend), but only if i close the app with ctrl+c. This also renders the terminal completely unusable for me. |
As a workaround (and good practice in general) for those who use vite, here's the config we will be recommending in the guides: {
// prevent vite from obscuring rust errors
clearScreen: false,
// tauri expects a fixed port, fail if that port is not available
server: {
port: 3000,
strictPort: true,
},
// to make use of `TAURI_PLATFORM`, `TAURI_ARCH`, `TAURI_FAMILY`, `TAURI_PLATFORM_VERSION`, `TAURI_PLATFORM_TYPE` and `TAURI_DEBUG` env variables
envPrefix: ['VITE_', 'TAURI_'],
build: {
// tauri supports es2021
target: ['es2021', 'chrome97', 'safari13'],
// don't minify for debug builds
minify: !process.env.TAURI_DEBUG && 'esbuild',
// produce sourcemaps for debug builds
sourcemap: !!process.env.TAURI_DEBUG,
},
} The important settings for this issue are these:
|
There is another approach in bash, where you can grab the PID of the last command run after sending to the background and then using
Not sure this is really going to work though, I do see the need for us to dive back into this problem. |
This is what I've been doing to kill the process:
|
The issue was fixed on Windows, but the Svelte template still has issues on Linux/macOS, we could only fix it using SIGKILL which is not a good approach. |
The issue should stay open then |
If anyone interested, you can kill the previous process when launching the app like so: |
@FabianLars As discussed on Discord it appears that the issue still persist on MacOS M1, with create-react-app, quitting the app from red cross or Dock. Quitting with Ctrl+C on CLI kills the process successfully.
|
Thanks for the steps to reproduce it, I'll give it a try soon. |
This issue still happens for me on Vite, mirrored from the Discord. To reproduce...
(I'll attach a text version when I can.) |
I have been running into the same issue. Is there a resolution to this? Killing the app with
|
npm i -D kill-port ./package.json {
"scripts":{
"dev": "kill-port 5173; npx tauri dev; kill-port 5173",
"dev:vite": "vite --port 5173 --mode ssr",
}
} ./src-tauri/tauri.conf.json {
"build": {
"beforeDevCommand": "npm run dev:vite",
"devPath": "http://localhost:5173",
}
} |
Describe the bug
Closing the
tauri dev
app window doesn't close the dev server started withbeforeDevCommand
(confirmed using thecreate-react-app
template forcreate-tauri-app
)To Reproduce
Steps to reproduce the behavior:
create-react-app
templatetauri dev
x
button or alt + f4tauri dev
again.Expected behavior
The dev server should be gracefully shut down when the app is closed.
The text was updated successfully, but these errors were encountered: