Repository: tauri
Issue: [bug] Application Updater Process Can't Restart - Tauri API error: Cross-device link (os error 18)
Labels: type: bug,platform: macOS,status: needs triage

### Describe the bug

I'm using the application updater with a static JSON file. 
```
{ 
  "version": "v0.4.0",
  "platforms": { 
    "darwin-x86_64": {
      "signature": "something", 
      "url": "https://something.com/macos/AppName.app.tar.gz" 
    }, 
    "darwin-aarch64": { 
      "signature": "something", 
      "url": "https://something.com/macos/AppName.app.tar.gz" 
    }
  } 
}
```

The app uses the built in dialog to prompt to install and restart the application. The updater status reaches "DONE" in dev mode:
```
Downloaded 16384 of Some(7682688)
Downloaded 16384 of Some(7682688)
Downloaded 14469 of Some(7682688)
Update has been downloaded!
App has been updated
```

After this, if I confirm that I would like to restart the application, I get the following error in the terminal, and the update is never applied:

```
thread ‘tokio-runtime-worker’ panicked at ‘application failed to start: Os { code: 2, kind: NotFound, message: “No such file or directory” }
```

Which points to this function in the tauri api/process.rs:
```
pub fn restart(env: &Env) {
  use std::process::{exit, Command};
  
  if let Ok(path) = current_binary(env) {
    Command::new(path)
      .args(&env.args)
      .spawn()
      .expect("application failed to start");
  }

  exit(0);
}
```

I tried to offload the updater functionality to the JavaScript side to see if I could get more information and built the app. Logging errors to the console, I also saw this error when built with an updater status of "DOWNLOADED" and then "ERROR":
```
Tauri API error: Cross-device link (os error 18) 
```

How do I get the restart and update functionality to be applied?

### Reproduction

1. Set tauri.conf.json to have an active updater with appropriate endpoints; Build the app with appropriate environment variables as noted in the [documentation](https://tauri.app/v1/guides/distribution/updater/#checking-for-updates).
2. Run the application locally and it will get the static JSON file containing version and platform information for the update (at this point the app prompts to update).
3. Confirm you would like to update.
4. Confirm to restart the application (this triggers the error).

### Expected behavior

I expect the application to restart successfully and apply the update.

### Platform and versions

```text

MacOS Monterey
version 12.3

> tauri info

Environment
  › OS: Mac OS 12.3.0 X64
  › Node.js: 18.12.1
  › npm: 8.19.2
  › pnpm: Not installed!
  › yarn: 1.22.19
  › rustup: 1.25.1
  › rustc: 1.65.0
  › cargo: 1.65.0
  › Rust toolchain: stable-aarch64-apple-darwin 

Packages
  › @tauri-apps/cli [NPM]: 1.2.3
  › @tauri-apps/api [NPM]: 1.2.0
  › tauri [RUST]: 1.2.1,
  › tauri-build [RUST]: 1.2.1,
  › tao [RUST]: 0.15.6,
  › wry [RUST]: 0.22.5,

App
  › framework: React
  › bundler: Vite

App directory structure
  ├─ ui
  ├─ tauri
  ├─ node_modules
  ├─ tests
  ├─ .github
  ├─ .git
```


### Stack trace

```text
__pthread_deallocate
thread 'tokio-runtime-worker' panicked at 'application failed to start: Os { code: 2, kind: NotFound, message: "No such file or directory" }'
```


### Additional context

I saw this [issue here](https://github.com/tauri-apps/tauri/issues/4500) regarding setting a tmp dir for Linux, so maybe it's related. However, I'm using Mac for now.

Also, the build process generates a tar.gz called <app_name>.app.tar.gz, detailed [here](https://tauri.app/v1/guides/distribution/updater/#update-artifacts)

However this line of code in the core.rs indicates that the tar.gz MUST have the arch, even though tauri only generates the .dmg with the version and the arch, and not the tar.gz:
https://github.com/tauri-apps/tauri/blob/076e1a81a50468e3dfb34ae9ca7e77c5e1758daa/core/tauri/src/updater/core.rs#L832
```
// MacOS
// ### Expected structure:
// ├── [AppName]_[version]_x64.app.tar.gz       # GZ generated by tauri-bundler
// │   └──[AppName].app                         # Main application
// │      └── Contents                          # Application contents...
```

Could this be related to by it's giving a Not Found error?

The logs show that it successfully got the tar.gz:
```
[2023-06-08][20:59:16][attohttpc][DEBUG] GET /<updater>.json HTTP/1.1
[2023-06-08][20:59:16][attohttpc][DEBUG] creating a length body reader
[2023-06-08][20:59:16][attohttpc][DEBUG] creating plain reader
[2023-06-08][20:59:16][attohttpc][DEBUG] status code 200
[2023-06-08][20:59:16][attohttpc][DEBUG] trying to connect to 
[2023-06-08][20:59:16][attohttpc][DEBUG] trying to connect to
[2023-06-08][20:59:16][attohttpc][DEBUG] successfully connected to , took 17ms
[2023-06-08][20:59:16][attohttpc][DEBUG] GET /macos/AppName.app.tar.gz HTTP/1.1
[2023-06-08][20:59:16][attohttpc][DEBUG] creating a length body reader
[2023-06-08][20:59:16][attohttpc][DEBUG] creating plain reader
[2023-06-08][20:59:16][attohttpc][DEBUG] status code 200
```