Skip to content

Commit

Permalink
fix: reading from stdin should broadcast EOF to block loaders
Browse files Browse the repository at this point in the history
otherwise results in a blocking wait when you do an extract-all but there are
missing blocks that you're waiting for a "done" signal for.
  • Loading branch information
rvagg committed Apr 6, 2023
1 parent 6c6051d commit a1147f2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/car/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func extractDir(c *cli.Context, ls *ipld.LinkSystem, n ipld.Node, outputRoot, ou
return 0, err
}
if c.IsSet("verbose") {
fmt.Fprintf(c.App.Writer, "%s\n", nextRes)
fmt.Fprintf(c.App.ErrWriter, "%s\n", nextRes)
}
}

Expand Down Expand Up @@ -401,6 +401,7 @@ func NewStdinReadStorage(reader io.Reader) (*stdinReadStorage, []cid.Cid, error)
if err == io.EOF {
srs.lk.Lock()
srs.done = true
srs.cond.Broadcast()
srs.lk.Unlock()
return
}
Expand Down

0 comments on commit a1147f2

Please sign in to comment.