fix bug for stdin checksumming
This commit is contained in:
parent
9e4d6b8f9e
commit
19870e8911
20
hash.go
20
hash.go
@ -43,14 +43,18 @@ func hsh(files []string) chan result {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(files) == 0 {
|
if len(files) == 0 {
|
||||||
hsh := h()
|
r := make(chan result)
|
||||||
_, err := io.Copy(hsh, os.Stdin)
|
go func() {
|
||||||
if err != nil {
|
hsh := h()
|
||||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
_, err := io.Copy(hsh, os.Stdin)
|
||||||
os.Exit(1)
|
if err != nil {
|
||||||
}
|
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||||
fmt.Printf("%x -\n", hsh.Sum(nil))
|
os.Exit(1)
|
||||||
return nil
|
}
|
||||||
|
r <- result{msg: fmt.Sprintf("%x -", hsh.Sum(nil))}
|
||||||
|
close(r)
|
||||||
|
}()
|
||||||
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
jobs := make(chan checksum)
|
jobs := make(chan checksum)
|
||||||
|
Loading…
Reference in New Issue
Block a user