Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): restart cannot handle binary name change on macOS #10991

Merged
merged 4 commits into from
Sep 14, 2024

Conversation

lucasfernog
Copy link
Member

Tauri v2 changed the default binary name of the bundled apps (no longer follows the productName, just uses the default name from Cargo instead). This breaks the restart function, which expects the current binary path to match the new one.

Due to this change, the restart() function for macOS is broken - the .app is correctly replaced even if the productName changed, but the restart() function cannot handle the new binary path. This change adds a simple check on macOS to read the Contents/MacOS folder and if it only contains a single binary, we use it to restart instead. This inference cannot be used if there's sidecars, so in this case we just let the existing implementation run and if it fails to restart, we do not panic but only warn and exit instead.

AppImage updates are not affected by this, and the Windows installer is responsible for restarting, so this change is only applied to macOS binaries.

Tauri v2 changed the default binary name of the bundled apps (no longer follows the productName, just uses the default name from Cargo instead). This breaks the `restart` function, which expects the current binary path to match the new one.

Due to this change, the restart() function for macOS is broken - the .app is correctly replaced even if the productName changed, but the restart() function cannot handle the new binary path. This change adds a simple check on macOS to read the `Contents/MacOS` folder and if it only contains a single binary, we use it to restart instead.
This inference cannot be used if there's sidecars, so in this case we just let the existing implementation run and if it fails to restart, we do not panic but only warn and exit instead.

AppImage updates are not affected by this, and the Windows installer is responsible for restarting, so this change is only applied to macOS binaries.
@lucasfernog lucasfernog requested a review from a team as a code owner September 13, 2024 20:57
Copy link
Contributor

github-actions bot commented Sep 13, 2024

Package Changes Through 5cac772

There are 3 changes which include tauri-bundler with minor, tauri with minor, tauri-build with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
tauri-bundler 1.6.1 1.7.0
tauri-build 1.5.4 1.5.5
tauri 1.7.2 1.8.0
@tauri-apps/cli 1.6.1 1.6.2
tauri-cli 1.6.1 1.6.2

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@lucasfernog
Copy link
Member Author

Closes tauri-apps/plugins-workspace#1746

Comment on lines 85 to 86
// on macOS on updates the binary name might have changed
// so we'll read the Contents/MacOS folder instead to infer the actual binary path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we read Contents/Info.plist to determine new binary name?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohhhhhh we can.. let's do that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amr the no-Apple dev that knows more about Apple than any other dev

amrbashir
amrbashir previously approved these changes Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants