mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-03-01 03:51:59 +01:00
29 lines
529 B
Go
29 lines
529 B
Go
|
//go:build !windows
|
||
|
|
||
|
// Copyright 2025, Command Line Inc.
|
||
|
// SPDX-License-Identifier: Apache-2.0
|
||
|
|
||
|
package sigutil
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
"os/signal"
|
||
|
"syscall"
|
||
|
|
||
|
"github.com/wavetermdev/waveterm/pkg/panichandler"
|
||
|
"github.com/wavetermdev/waveterm/pkg/util/utilfn"
|
||
|
)
|
||
|
|
||
|
func InstallSIGUSR1Handler() {
|
||
|
sigCh := make(chan os.Signal, 1)
|
||
|
signal.Notify(sigCh, syscall.SIGUSR1)
|
||
|
go func() {
|
||
|
defer func() {
|
||
|
panichandler.PanicHandler("InstallSIGUSR1Handler", recover())
|
||
|
}()
|
||
|
for range sigCh {
|
||
|
utilfn.DumpGoRoutineStacks()
|
||
|
}
|
||
|
}()
|
||
|
}
|