From 6a4fdaa33af75791322aca5766c655c67f7fcf09 Mon Sep 17 00:00:00 2001 From: simulot Date: Mon, 27 May 2024 19:12:19 +0200 Subject: [PATCH] Fallback to no-gui mode when the UI can't be created Fixes #261 --- cmd/upload/upload.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/upload/upload.go b/cmd/upload/upload.go index 23422a33..ee079cb8 100644 --- a/cmd/upload/upload.go +++ b/cmd/upload/upload.go @@ -14,6 +14,7 @@ import ( "sync" "time" + "github.com/gdamore/tcell/v2" "github.com/google/uuid" "github.com/simulot/immich-go/browser" "github.com/simulot/immich-go/browser/files" @@ -210,6 +211,13 @@ func (app *UpCmd) run(ctx context.Context) error { if app.NoUI { return app.runNoUI(ctx) } + + _, err = tcell.NewScreen() + if err != nil { + app.Log.Error("can't initialize the screen for the UI mode. Falling back to no-gui mode") + fmt.Println("can't initialize the screen for the UI mode. Falling back to no-gui mode") + return app.runNoUI(ctx) + } return app.runUI(ctx) }