mirror of
https://github.com/samuelncui/yatm.git
synced 2026-11-08 12:26:33 +00:00
Unify file queries and Scan execution, retain indexed Identical results, improve Job and Preview workflows, and verify release packaging.
28 lines
386 B
Go
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
|
|
}
|