mirror of
https://gitea.com/gitea/gitea-mcp.git
synced 2025-08-23 14:23:05 +00:00
feat: add context management and cancellation handling in Execute
function
- Import the `context` package - Add context cancellation handling with log message and return in `Execute` function Signed-off-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
|
||||
"gitea.com/gitea/gitea-mcp/operation"
|
||||
@@ -57,6 +58,10 @@ func init() {
|
||||
func Execute(version string) {
|
||||
defer log.Default().Sync()
|
||||
if err := operation.Run(transport, version); err != nil {
|
||||
if err == context.Canceled {
|
||||
log.Info("Server shutdown due to context cancellation")
|
||||
return
|
||||
}
|
||||
log.Fatalf("Run Gitea MCP Server Error: %v", err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user