Repository: tauri
Issue: [bug] [Windows / v2] beforeDevCommand is not killed when compiling failed with --no-watch
Labels: type: bug,status: needs triage

### Describe the bug

On windows, `beforeDevCommand` is not killed when compiling src-tauri failed with --no-watch.
This causes "Port 1420 is already in use" error.

### Reproduction

1. `pnpm create tauri-app --beta tauri-test` (I also reproduced the issue on bun)
2. Make `src-tauri/main.rs` invalid (I replaced `format!` with `formt!`)
3. `pnpm tauri dev --no-watch` (`nr tauri dev --no-watch`), and make sure the compiling failed
4. `curl localhost:1420`

### Expected behavior

Vite is killed (`curl localhost:1420` should be error)

### Full `tauri info` output

```text
❯ nr tauri info

> tauri-test@0.0.0 tauri E:\tauri-test
> tauri "info"

(node:101008) Warning: The 'NODE_DISABLE_COLORS' env is ignored due to the 'FORCE_COLOR' env being set.
(Use `node --trace-warnings ...` to show where the warning was created)

[✔] Environment
    - OS: Windows 10.0.19045 X64
    ✔ WebView2: 125.0.2535.92
    ✔ MSVC:
        - Visual Studio Build Tools 2019
        - Visual Studio Build Tools 2022
        - Visual Studio Community 2022
    ✔ rustc: 1.78.0 (9b00956e5 2024-04-29)
    ✔ cargo: 1.78.0 (54d8815d0 2024-03-26)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 20.12.2
    - pnpm: 8.12.1
    - yarn: 1.22.5
    - npm: 10.5.2
    - bun: 1.1.12

[-] Packages
    - tauri [RUST]: 2.0.0-beta.22
    - tauri-build [RUST]: 2.0.0-beta.17
    - wry [RUST]: 0.40.1
    - tao [RUST]: 0.28.0
    - @tauri-apps/api [NPM]: 2.0.0-beta.13
    - @tauri-apps/cli [NPM]: 2.0.0-beta.20

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - bundler: Vite
```


### Stack trace

```text
❯ nr tauri dev --no-watch

> tauri-test@0.0.0 tauri E:\tauri-test
> tauri "dev" "--no-watch"

(node:52948) Warning: The 'NODE_DISABLE_COLORS' env is ignored due to the 'FORCE_COLOR' env being set.
(Use `node --trace-warnings ...` to show where the warning was created)
    Running BeforeDevCommand (`pnpm dev`)
(node:122572) Warning: The 'NODE_DISABLE_COLORS' env is ignored due to the 'FORCE_COLOR' env being set.
(Use `node --trace-warnings ...` to show where the warning was created)

> tauri-test@0.0.0 dev E:\tauri-test
> vite

(node:102740) Warning: The 'NODE_DISABLE_COLORS' env is ignored due to the 'FORCE_COLOR' env being set.
(Use `node --trace-warnings ...` to show where the warning was created)

  VITE v5.2.13  ready in 672 ms

  ➜  Local:   http://localhost:1420/
  ➜  Network: use --host to expose
   Compiling tauri-test v0.0.0 (E:\tauri-test\src-tauri)
error: cannot find macro `formt` in this scope
   --> src\main.rs:7:5
    |
7   |     formt!("Hello, {}! You've been greeted from Rust!", name)
    |     ^^^^^ help: a macro with a similar name exists: `format`
    |
   ::: C:\Users\UserName\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\alloc\src\macros.rs:123:1
    |
123 | macro_rules! format {
    | ------------------- similarly named macro `format` defined here

error: could not compile `tauri-test` (bin "tauri-test") due to 1 previous error

E:\tauri-test via  v20.12.2 took 14s at 10:38:13
❯ curl localhost:1420
<!doctype html>
<html lang="en">
  ...
</html>
```


### Additional context

_No response_