waveterm/pkg/util/sigutil/sigusr1_notwindows.go

29 lines
529 B
Go
Raw Permalink Normal View History

//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()
}
}()
}