Fix onboard test deadlock on Windows

This commit is contained in:
Codex Agent
2025-11-17 11:26:59 -07:00
parent 4cd26c8e5a
commit 4e222145ac
2 changed files with 47 additions and 59 deletions

View File

@@ -2,31 +2,14 @@ package main
import (
"bytes"
"os"
"strings"
"testing"
)
func TestOnboardCommand(t *testing.T) {
// Save original stdout
oldStdout := os.Stdout
defer func() { os.Stdout = oldStdout }()
t.Run("onboard output contains key sections", func(t *testing.T) {
// Create a pipe to capture output
r, w, err := os.Pipe()
if err != nil {
t.Fatalf("Failed to create pipe: %v", err)
}
os.Stdout = w
// Run onboard command
onboardCmd.Run(onboardCmd, []string{})
// Close writer and read output
w.Close()
var buf bytes.Buffer
buf.ReadFrom(r)
renderOnboardInstructions(&buf)
output := buf.String()
// Verify output contains expected sections