[bug] two windows showing from dev command
Describe the bug
A user reported an issue in the Discord server about having 2 windows popping up for them. After quite a bit of debugging we discovered that the cause of the issue was that the CLI is trying to connect to Github to fetch the metadata.json file to check if there's a newer version available. Because they live in India with the Jio ISP they aren't allowed to connect to Github however they want. The issue seems to be that when they launch one dev command it takes like 15-20 seconds or so for it to exit, and the culprit appears to be the update checking. When they connect to a VPN the issue goes away. That's right, they get 2 windows popping up, and the fix it connecting to a VPN. Logic 👍🏻
The issue appears to be caused by an orphaned process as a result of improper handling of abrupt closing of the app. If they sit patiently and wait for it to exit, there's no issue. It only happens when they exit the app prematurely with ctrl + c.
Reproduction
There shouldn't be anything special about the project setup, the issue is in the CLI. So set up a basic CTA project and run it as per usual. The trick is that the user in question with the issue is in a country where the ISP doesn't allow connecting to Github however they want, so they had to use a VPN solution for it. So not entirely sure how to replicate it if you're not in one of those countries. Maybe VPN into one of those countries.
- Move to India
- Get internet from the ISP "Jio"
yarn create tauri-appyarn tauri dev- ctrl + c out of the app because it takes like 20 seconds for it to exit
yarn tauri dev
You should now be seeing 2 windows.
Expected behavior
One window should appear, not two. The update checking should've exited immediately and not been the cause of some orphaned process in the background causing issues.
My suggestion for resolving this is moving the functionality away from the dev command entirely, split it off into a dedicated check-updates command instead.
In addition to this we still need to add some more proper handling of the update checker so that there's no orphaned processes. If the dev command had exited properly in the first place this issue probably wouldn't have surfaced.
Platform and versions
yarn run v1.22.19
$ tauri info
[✔] Environment
- OS: Windows 10.0.22621 X64
✔ WebView2: 114.0.1823.51
✔ MSVC: Visual Studio Community 2022
✔ rustc: 1.70.0-nightly (9df3a39fb 2023-04-11)
✔ Cargo: 1.70.0-nightly (7bf43f028 2023-04-10)
✔ rustup: 1.25.2 (17db695f1 2023-02-01)
✔ Rust toolchain: nightly-x86_64-pc-windows-msvc (default)
- node: 18.15.0
- yarn: 1.22.19
- npm: 9.5.0
[-] Packages
- tauri [RUST]: 1.4.1
- tauri-build [RUST]: 1.4.0
- wry [RUST]: 0.24.3
- tao [RUST]: 0.16.2
- @tauri-apps/api [NPM]: 1.4.0
- @tauri-apps/cli [NPM]: 1.4.0
[-] App
- build-type: bundle
- CSP: unset
- distDir: ../dist
- devPath: http://localhost:1420/
- framework: Svelte
- bundler: Vite
Done in 10.31s.
Stack trace
No response
Additional context
The affected user goes by the name "Best" with handle "bestc" in the Discord server.
Workaround
If you're affected by this you can try the debug version of the CLI instead since it shouldn't be checking for updates. Or you can get a VPN.
cargo install tauri-cli --debug
When we renamed the package names in the metadata file somewhere around v1.3 you could spawn even more windows. Everytime you restarted it, the amount of windows ~doubled.
But yeah, like discussed on Discord i really think this "feature" should be removed completely (especially now that it shows the wrong version too).
I'll try to work on that today if nobody is against that.
Edit: I wrote this comment before seeing the new discord convos about it.