File tree 4 files changed +7
-4
lines changed
4 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ func monitor() {
91
91
if err != nil {
92
92
log .Fatalf ("StdinPipe: %v" , err )
93
93
}
94
- debug .SetCrashOutput (pipe .(* os.File )) // (this conversion is safe)
94
+ debug .SetCrashOutput (pipe .(* os.File ), debug. CrashOptions {} ) // (this conversion is safe)
95
95
if err := cmd .Start (); err != nil {
96
96
log .Fatalf ("can't start monitor: %v" , err )
97
97
}
Original file line number Diff line number Diff line change @@ -31,6 +31,9 @@ func Stack() []byte {
31
31
}
32
32
}
33
33
34
+ // CrashOptions is a placeholder type for future options to SetCrashOutput.
35
+ type CrashOptions struct {}
36
+
34
37
// SetCrashOutput configures a single additional file where unhandled
35
38
// panics and other fatal errors are printed, in addition to standard error.
36
39
// There is only one additional file: calling SetCrashOutput again overrides
@@ -40,7 +43,7 @@ func Stack() []byte {
40
43
// To disable this additional crash output, call SetCrashOutput(nil).
41
44
// If called concurrently with a crash, some in-progress output may be written
42
45
// to the old file even after an overriding SetCrashOutput returns.
43
- func SetCrashOutput (f * os.File ) error {
46
+ func SetCrashOutput (f * os.File , opts CrashOptions ) error {
44
47
fd := ^ uintptr (0 )
45
48
if f != nil {
46
49
// The runtime will write to this file descriptor from
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ func TestMain(m *testing.M) {
29
29
if err != nil {
30
30
log .Fatal (err )
31
31
}
32
- if err := SetCrashOutput (f ); err != nil {
32
+ if err := SetCrashOutput (f , CrashOptions {} ); err != nil {
33
33
log .Fatal (err ) // e.g. EMFILE
34
34
}
35
35
println ("hello" )
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ func crash() {
28
28
// Ensure that we get pc=0x%x values in the traceback.
29
29
debug .SetTraceback ("system" )
30
30
writeSentinel (os .Stdout )
31
- debug .SetCrashOutput (os .Stdout )
31
+ debug .SetCrashOutput (os .Stdout , debug. CrashOptions {} )
32
32
33
33
go func () {
34
34
// This call is typically inlined.
You can’t perform that action at this time.
0 commit comments