fix: resolve missing users in piped commands and refine TUI distribution
This commit is contained in:
@@ -22,12 +22,21 @@ func debugLog(format string, args ...any) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Define flags
|
||||
serverAddr := flag.String("server", "127.0.0.1:9987", "TeamSpeak 3 Server Address")
|
||||
nickname := flag.String("nickname", "TUI-User", "Your nickname")
|
||||
debug := flag.Bool("debug", true, "Enable debug logging to file (default true)")
|
||||
flag.Parse()
|
||||
|
||||
// Disable log output completely to prevent TUI corruption (stdout is reserved for UI)
|
||||
// Panic Recovery
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
fmt.Fprintf(os.Stderr, "Panic recovered: %v\n", r)
|
||||
os.Exit(1)
|
||||
}
|
||||
}()
|
||||
|
||||
// Disable log output initially
|
||||
log.SetOutput(io.Discard)
|
||||
|
||||
// Enable debug file logging if requested
|
||||
@@ -41,6 +50,9 @@ func main() {
|
||||
debugLog("TUI Debug started at %s", timestamp)
|
||||
// Redirect standard log output to debug file initially
|
||||
log.SetOutput(debugFile)
|
||||
} else {
|
||||
fmt.Fprintf(os.Stderr, "Failed to create debug log: %v\n", err)
|
||||
log.SetOutput(os.Stderr) // Fallback to stderr
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user