tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
82.09k stars 2.47k forks source link

Signed MacOS Tauri Build - Unhandled Promise Rejection: shell error: failed to open: Scoped shell IO error: Launcher failed with ExitStatus(unix_wait_status(256)) #5893

Open AdlerJS opened 1 year ago

AdlerJS commented 1 year ago

Describe the bug

I have a signed MacOS Tauri build for distribution and when I try and use shell.open to open a fileDir on the computer it results in the following error being thrown Unhandled Promise Rejection: shell error: failed to open: Scoped shell IO error: Launcher failed with ExitStatus(unix_wait_status(256))

Note: The code works in local develop and in unsigned builds this only occurs in signed macOS builds.

Code Example:

const filePath = await dialog.save();
const fileDir = dirname(filePath);
shell.open(fileDir); // Note - fileDir is something like Users/Dan/Desktop

Tauri Config (shell):

 "shell": {
        "all": true,
        "execute": true,
        "sidecar": true,
        "open": "^"
      }

Reproduction

1.) Create a signed mac os build 2.) Use shell.open to open a local file directory

Expected behavior

Local file directory should open on signed macOS builds

Platform and versions

Environment
  › OS: Mac OS 12.6.0 X64
  › Node.js: 14.16.1
  › npm: 6.14.12
  › pnpm: Not installed!
  › yarn: 1.22.19
  › rustup: 1.25.1
  › rustc: 1.63.0
  › cargo: 1.63.0
  › Rust toolchain: stable-x86_64-apple-darwin

Packages
  › @tauri-apps/cli [NPM]: 1.2.0 (outdated, latest: 1.2.2)
  › @tauri-apps/api [NPM]: 1.2.0
  › tauri [RUST]: 1.2.0,
  › tauri-build [RUST]: 1.2.0,
  › tao [RUST]: 0.15.3,
  › wry [RUST]: 0.22.0,

App
  › build-type: bundle
  › CSP: unset
  › distDir: ../build
  › devPath: http://localhost:4003/
  › framework: React

App directory structure
  ├─ _templates
  ├─ node_modules
  ├─ gsuite
  ├─ ios
  ├─ android-old
  ├─ public
  ├─ android
  ├─ src-tauri
  ├─ build
  ├─ .git
  ├─ .idea
  └─ src

Stack trace

No response

Additional context

No response

glen0125 commented 1 year ago

same problem

glen0125 commented 1 year ago

I solved the problem by using the original rust open and calling it using invoke, maybe you need to pass in a specific app using open::with to get it to work.

Zertz commented 1 year ago

Tangentially related, did you follow any specific instructions to publish a signed build on the Mac App Store?

Hacksore commented 3 months ago

So I have some code that does something like this to create the dir.

// crate the config dir if it's not there
try {
  await createDir(await appConfigDir(), {
    recursive: true,
  });
} catch (err: unknown) {
  // noop
}

Seems that it makes a folder but it's beyond cursed...

$ file /Users/hacksore/Library/Application\ Support/com.overlayed.app
/Users/hacksore/Library/Application Support/com.overlayed.app: directory

$ ls /Users/hacksore/Library/Application\ Support/com.overlayed.app                                                                                      
config.json

image

When I go to call shell.open on the directory I get:

Unhandled Promise Rejection: shell error: failed to open: Scoped shell IO error: Launcher failed with ExitStatus(unix_wait_status(256))
Hacksore commented 3 months ago

Ok well im dumb, you can't call your app namespace ending in .app cause it will think it's a macOS app 😂