Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hiddify-sing-box
Submodule hiddify-sing-box updated 731 files
9 changes: 0 additions & 9 deletions v2/hutils/andorid_utils.go

This file was deleted.

27 changes: 27 additions & 0 deletions v2/hutils/crashlog_utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//go:build darwin || linux || android

package hutils

import (
"os"
"runtime/debug"
)

// RedirectStderr writes Go crash reports into path so they survive with no
// terminal attached. Reimplemented locally after libbox.RedirectStderr became
// private upstream. Windows has its own no-op variant.
func RedirectStderr(path string) error {
if stats, err := os.Stat(path); err == nil && stats.Size() > 0 {
_ = os.Rename(path, path+".old")
}
outputFile, err := os.Create(path)
if err != nil {
return err
}
if err = debug.SetCrashOutput(outputFile, debug.CrashOptions{}); err != nil {
outputFile.Close()
os.Remove(outputFile.Name())
return err
}
return nil
}
9 changes: 0 additions & 9 deletions v2/hutils/darwin_utils.go

This file was deleted.

5 changes: 0 additions & 5 deletions v2/hutils/linux_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,9 @@ import (
"path/filepath"
"strings"

"github.com/sagernet/sing-box/experimental/libbox"
"golang.org/x/sys/unix"
)

func RedirectStderr(path string) error {
return libbox.RedirectStderr(path)
}

func IsAdmin() bool {
return os.Getuid() == 0
}
Expand Down
Loading