[cmds] Handle edge cases when running tauri in beta
This commit is contained in:
@@ -30,7 +30,8 @@ const (
|
||||
ControlledFailureExitCode = 24
|
||||
|
||||
// StartOldUIExitCode is an exit code that is returned by the UI when there. This is manfully triaged by the user, if the new UI does not work for them.
|
||||
StartOldUIExitCode = -3
|
||||
StartOldUIExitCode = 77
|
||||
MissingDependencyExitCode = 0xc0000135 // Windows STATUS_DLL_NOT_FOUND
|
||||
|
||||
exeSuffix = ".exe"
|
||||
zipSuffix = ".zip"
|
||||
@@ -60,7 +61,21 @@ type Options struct {
|
||||
RestartOnFail bool // Try restarting automatically, if the started component fails.
|
||||
}
|
||||
|
||||
// This is a temp value that will be used to test the new UI in beta.
|
||||
var app2Options = Options{
|
||||
Name: "Portmaster App2",
|
||||
Identifier: "app2/portmaster",
|
||||
AllowDownload: false,
|
||||
AllowHidingWindow: false,
|
||||
RestartOnFail: true,
|
||||
}
|
||||
|
||||
func init() {
|
||||
// Make sure the new UI has a proper extension.
|
||||
if onWindows {
|
||||
app2Options.Identifier += ".exe"
|
||||
}
|
||||
|
||||
registerComponent([]Options{
|
||||
{
|
||||
Name: "Portmaster Core",
|
||||
@@ -75,6 +90,7 @@ func init() {
|
||||
Identifier: "app/portmaster-app.zip",
|
||||
AllowDownload: false,
|
||||
AllowHidingWindow: false,
|
||||
RestartOnFail: true,
|
||||
},
|
||||
{
|
||||
Name: "Portmaster App2",
|
||||
@@ -322,11 +338,11 @@ func persistOutputStreams(opts *Options, version string, cmd *exec.Cmd) (chan st
|
||||
}
|
||||
|
||||
func execute(opts *Options, args []string) (cont bool, err error) {
|
||||
if registry.UsePreReleases && opts.ShortIdentifier == "app" {
|
||||
if !forceOldUI && registry.UsePreReleases && opts.ShortIdentifier == "app" {
|
||||
// Check if new ui was already tried.
|
||||
if !fallBackToOldUI {
|
||||
opts.Identifier = "app2/portmaster"
|
||||
opts.ShortIdentifier = "app2"
|
||||
opts = &app2Options
|
||||
log.Println("Using new UI")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -462,6 +478,9 @@ func parseExitError(err error) (restart bool, errWithCtx error) {
|
||||
case StartOldUIExitCode:
|
||||
fallBackToOldUI = true
|
||||
return true, errors.New("user requested old UI")
|
||||
case MissingDependencyExitCode:
|
||||
fallBackToOldUI = true
|
||||
return true, errors.New("new UI failed with missing dependency")
|
||||
default:
|
||||
return true, fmt.Errorf("unknown exit code %w", exErr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user