Skip to content

Commit 328724b

Browse files
committed
fix errors from being double printed
1 parent 25227c8 commit 328724b

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

cmd/wsh/cmd/wshcmd-termscrollback.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ func termScrollbackRun(cmd *cobra.Command, args []string) (rtnErr error) {
8080
Timeout: 5000,
8181
})
8282
if err != nil {
83-
fmt.Fprintf(os.Stderr, "error getting terminal scrollback: %v\n", err)
84-
return err
83+
return fmt.Errorf("error getting terminal scrollback: %w", err)
8584
}
8685

8786
// Format the output
@@ -94,8 +93,7 @@ func termScrollbackRun(cmd *cobra.Command, args []string) (rtnErr error) {
9493
if termScrollbackOutputFile != "" {
9594
err = os.WriteFile(termScrollbackOutputFile, []byte(output), 0644)
9695
if err != nil {
97-
fmt.Fprintf(os.Stderr, "error writing to file %s: %v\n", termScrollbackOutputFile, err)
98-
return err
96+
return fmt.Errorf("error writing to file %s: %w", termScrollbackOutputFile, err)
9997
}
10098
fmt.Printf("terminal scrollback written to %s (%d lines)\n", termScrollbackOutputFile, len(result.Lines))
10199
} else {

0 commit comments

Comments
 (0)