Skip to content
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

When using KillProcess or KillProcessCurrentUser to close the tauri application during uninstallation, the tauri application cannot perform pre exit processing #39

Open
Aostas opened this issue Aug 12, 2024 · 1 comment · May be fixed by tauri-apps/tauri#11041

Comments

@Aostas
Copy link

Aostas commented Aug 12, 2024

KillProcess or KillProcessCurrentUser will call TerminateProcess, which will force the process to terminate and the process will not receive any signals.
My Tauri application needs to perform some cleaning and closing child processes before terminate, which can result in orphan processes and occupy files in the application directory, leading to uninstallation and reinstallation exceptions.
I tried to change TerminateProcess to GenerateConsoleCtrlEvent and replace nsis-tauri-utils.dll, but Tauri detects the hash value of the file and corrects it during build, so I cannot confirm if GenerateConsoleCtrlEvent will work.

@Aostas
Copy link
Author

Aostas commented Aug 12, 2024

GenerateConsoleCtrlEvent does not work,But I found a solution.
Just call taskkill.exe /PID {pid} /F /T.
taskkill.exe /PID {pid} /F is equivalent to TerminateProcess, and the Process::kill function in the sysinfo crate is also implemented with this. Add /T(tree kill) to close all child processes and solve the issue.

amrbashir added a commit to tauri-apps/tauri that referenced this issue Sep 18, 2024
`nsis_process` dll is written by us in https://github.com/tauri-apps/nsis-tauri-utils but anti virus tools picks it up as virus. Its code does as much as `nsProcess` but I guss we just don't have enough popularity as `nsProcess` has with anti-virus tools.

closes tauri-apps/nsis-tauri-utils#39
ref: tauri-apps/nsis-tauri-utils#37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant