Skip to content

Commit

Permalink
see if windows test failure is due to linebreaks
Browse files Browse the repository at this point in the history
  • Loading branch information
willscott committed Sep 15, 2021
1 parent 512555b commit 3039159
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/car/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"io"
"os"
"runtime"

carv2 "github.com/ipld/go-car/v2"
"github.com/urfave/cli/v2"
Expand Down Expand Up @@ -38,6 +39,10 @@ func ListCar(c *cli.Context) error {
return err
}

linebreak := "\n"
if runtime.GOOS == "windows" {
linebreak = "\r\n"
}
for {
blk, err := rd.Next()
if err != nil {
Expand All @@ -46,7 +51,7 @@ func ListCar(c *cli.Context) error {
}
return err
}
fmt.Fprintf(outStream, "%s\n", blk.Cid())
fmt.Fprintf(outStream, "%s%s", blk.Cid(), linebreak)
}

return err
Expand Down

0 comments on commit 3039159

Please sign in to comment.