Skip to content

Commit

Permalink
🔊 Forward command server's stderr to client
Browse files Browse the repository at this point in the history
  • Loading branch information
wesen committed Jan 21, 2025
1 parent 3ce7ee9 commit 1f663b8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 9 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,12 @@ Improved server logging when running as a command:
- Added [SERVER] tag prefix to all server log messages
- Configured stderr output to be forwarded to client
- Preserved log level and timestamp formatting
- Improved log message readability for debugging
- Improved log message readability for debugging

# Command Server Logging

Enhanced command server logging:

- Forward command server's stderr to client's stderr
- Allows seeing server logs directly in client's terminal
- Helps with debugging command server issues
3 changes: 3 additions & 0 deletions pkg/client/stdio.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ func NewCommandStdioTransport(command string, args ...string) (*StdioTransport,
return nil, fmt.Errorf("failed to create stdout pipe: %w", err)
}

// Forward stderr to client's stderr
cmd.Stderr = os.Stderr

if err := cmd.Start(); err != nil {
logger.Error().Err(err).Msg("Failed to start command")
return nil, fmt.Errorf("failed to start command: %w", err)
Expand Down

0 comments on commit 1f663b8

Please sign in to comment.