Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: reading from stdin should broadcast EOF to block loaders #409

Merged
merged 2 commits into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion cmd/car/testdata/script/create-extract.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
car create --file=out.car foo.txt bar.txt
mkdir out
car extract -v -f out.car out
stdout -count=2 'txt$'
stderr -count=2 'txt$'
stderr -count=1 '^extracted 2 file\(s\)$'
car create --file=out2.car out/foo.txt out/bar.txt
cmp out.car out2.car
Expand Down