Commit 72694ed6 authored by Jeromy's avatar Jeromy

commands: fix panic when stdin is empty for string args

License: MIT
Signed-off-by: default avatarJeromy <why@ipfs.io>
parent 4776d44d
......@@ -240,13 +240,19 @@ func (r *request) VarArgs(f func(string) error) error {
return err
}
var any bool
scan := bufio.NewScanner(fi)
for scan.Scan() {
any = true
err := f(scan.Text())
if err != nil {
return err
}
}
if !any {
return f("")
}
return nil
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment