context passing
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"galaxy/client"
|
||||
mc "galaxy/model/client"
|
||||
"os"
|
||||
"os/signal"
|
||||
|
||||
"fyne.io/fyne/v2/app"
|
||||
)
|
||||
@@ -27,7 +29,11 @@ func main() {
|
||||
settings := mc.Settings{
|
||||
StoragePath: ".",
|
||||
}
|
||||
c, err := client.NewClient(nil, app, settings)
|
||||
|
||||
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
|
||||
defer cancel()
|
||||
|
||||
c, err := client.NewClient(ctx, nil, app, settings)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user