fix: write CLI and streaming errors to stderr

## CHANGES
- Route CLI execution errors to standard error output
- Print Anthropic stream errors to stderr consistently
- Add os import to support stderr error writes
- Preserve help-output suppression and exit behavior
This commit is contained in:
Kayvan Sylvan
2025-12-13 00:02:44 -08:00
parent 2a1e8dcf12
commit deb59bdd21
2 changed files with 3 additions and 2 deletions

View File

@@ -12,7 +12,7 @@ import (
func main() {
err := cli.Cli(version)
if err != nil && !flags.WroteHelp(err) {
fmt.Printf("%s\n", err)
fmt.Fprintf(os.Stderr, "%s\n", err)
os.Exit(1)
}
}

View File

@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net/http"
"os"
"strconv"
"strings"
@@ -216,7 +217,7 @@ func (an *Client) SendStream(
}
if stream.Err() != nil {
fmt.Printf("Messages stream error: %v\n", stream.Err())
fmt.Fprintf(os.Stderr, "Messages stream error: %v\n", stream.Err())
}
close(channel)
return