#Infinite number of app windows being created

8 messages · Page 1 of 1 (latest)

upper zealot
#

Hello, I am starting my journey with Tauri (and Rust!) and I'm having trouble with getting a sidecar working.

Here's my lib.rs file:

use tauri_plugin_shell::ShellExt;

#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
    //let _ = CryptoProvider::install_default();
    tauri::Builder::default()
        .plugin(tauri_plugin_opener::init())
        .plugin(tauri_plugin_websocket::init())
        .plugin(tauri_plugin_shell::init())
        .invoke_handler(tauri::generate_handler![greet])
        .setup(setup)
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

fn setup<'a>(app: &'a mut tauri::App) -> Result<(), Box<dyn std::error::Error>> {
    
    let sidecar_command = app.shell().sidecar("Glass.Server").unwrap();
    let (mut rx, mut _child) = sidecar_command
      .spawn()
      .expect("Failed to spawn sidecar");

    Ok(())
}

If I comment the lines inside the setup function (aside from Ok(())), the app works fine. Otherwise, I get a new window created every second or so until I stop the npm run tauri dev command in my terminal.

I added the following permissions in my default.json :

  "permissions": [
    "core:default",
    "opener:default",
    "websocket:default",
    {
      "identifier": "shell:allow-spawn",
      "allow": [
        {
          "name": "../src-server/Glass.Server/bin/Release/net8.0/win-x64/publish/Glass.Server",
          "sidecar": true
        }
      ]
    },
    "shell:allow-open"
  ]

I am running on Windows and I do have an executable located here: src-server\Glass.Server\bin\Release\net8.0\win-x64\publish\Glass.Server-x86_64-pc-windows-msvc.exe

Any help would be really appreciated, thanks 🙂

cobalt mural
#

i doubt it's related but can you try renaming Glass.Server to GlassServer ?

upper zealot
#

That was it!

#

Ahhh it feels so good. Last time I had to shut down my computer because the windows were being created even with my terminal closed 😅

cobalt mural
#

Can you still open a github issue about this please? dots in filenames should be supported or throw explicit errors but not cause this issue x)

upper zealot
#

Yes

upper zealot
#

Upon testing, it seems filenames with dots are not supported. Normally, an error will be thrown that the file can't be found, but in my edge case, the sidecar's filename had the same prefix as the name of the app (Glass.Server.exe and Glass.exe) and Tauri launched my main exe endlessly