Skip to content

Commit

Permalink
internal/crashmonitor: update the type of the setCrashOutput function
Browse files Browse the repository at this point in the history
  • Loading branch information
Stavrospanakakis committed May 6, 2024
1 parent ea995a9 commit 5a429a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions internal/crashmonitor/crash_go123.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@

package crashmonitor

import "runtime/debug"
import (
"os"
"runtime/debug"
)

func init() {
setCrashOutput = debug.SetCrashOutput
setCrashOutput = func(f *os.File) error {
return debug.SetCrashOutput(f)
}
}
4 changes: 2 additions & 2 deletions internal/crashmonitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ import (
// TODO(adonovan): eliminate once go1.23+ is assured.
func Supported() bool { return setCrashOutput != nil }

var setCrashOutput func(*os.File, debug.CrashOptions) error // = runtime.SetCrashOutput on go1.23+
var setCrashOutput func(*os.File) error // = runtime.SetCrashOutput on go1.23+

// Parent sets up the parent side of the crashmonitor. It requires
// exclusive use of a writable pipe connected to the child process's stdin.
func Parent(pipe *os.File) {
writeSentinel(pipe)
// Ensure that we get pc=0x%x values in the traceback.
debug.SetTraceback("system")
setCrashOutput(pipe, debug.CrashOptions{})
setCrashOutput(pipe)
}

// Child runs the part of the crashmonitor that runs in the child process.
Expand Down

0 comments on commit 5a429a9

Please sign in to comment.