feat(platform): 多平台检测/路径/信号/系统信息(含跨平台构建验证)
This commit is contained in:
1 parent
efed5f05b1
commit
1d4bed415f
6 files changed
+276
No files matched your search
@@ -0,0 +1,14 @@
|
||||
package platform
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os/signal"
|
||||
)
|
||||
|
||||
// SignalContext returns a context canceled when an interactive termination
|
||||
// signal arrives: Ctrl+C on every OS, plus SIGTERM on Unix. It is the single
|
||||
// graceful-shutdown hook for the whole process.
|
||||
func SignalContext() (context.Context, context.CancelFunc) {
|
||||
ctx, cancel := signal.NotifyContext(context.Background(), shutdownSignals()...)
|
||||
return ctx, cancel
|
||||
}
|
||||
Reference in new issue
Block a user