Files
yatm/internal/tools/context.go
T
Samuel Cui 4fef653b71 Prepare YATM v1.0.0-alpha.2
Unify file queries and Scan execution, retain indexed Identical results,
improve Job and Preview workflows, and verify release packaging.
2026-10-05 19:08:49 +08:00

28 lines
386 B
Go

package tools
import (
"context"
"log"
"os"
"os/signal"
"syscall"
)
var (
ShutdownContext context.Context
)
func init() {
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
bgctx, cancel := context.WithCancel(context.Background())
go func() {
oscall := <-c
log.Printf("system call: %+v", oscall)
cancel()
}()
ShutdownContext = bgctx
}