Skip to content

Commit

Permalink
Maybe Dev Server works
Browse files Browse the repository at this point in the history
  • Loading branch information
amh4r committed Aug 7, 2024
1 parent 9fef017 commit 029a53c
Showing 1 changed file with 1 addition and 36 deletions.
37 changes: 1 addition & 36 deletions tests/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,42 +58,7 @@ func startDevServer() (func() error, error) {
// Run in a new process group so we can kill the process and its children
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}

// Read and print stderr
stderr, err := cmd.StderrPipe()
if err != nil {
return nil, fmt.Errorf("failed to create stderr pipe: %w", err)
}
go func() {
buf := make([]byte, 1024)
for {
n, err := stderr.Read(buf)
if n > 0 {
fmt.Print(string(buf[:n]))
}
if err != nil {
break
}
}
}()

stdout, err := cmd.StdoutPipe()
if err != nil {
return nil, fmt.Errorf("failed to create stdout pipe: %w", err)
}
go func() {
buf := make([]byte, 1024)
for {
n, err := stdout.Read(buf)
if n > 0 {
fmt.Print(string(buf[:n]))
}
if err != nil {
break
}
}
}()

err = cmd.Start()
err := cmd.Start()
if err != nil {
return nil, fmt.Errorf("failed to start command: %w", err)
}
Expand Down

0 comments on commit 029a53c

Please sign in to comment.