Treat write errors in man doc generation
Just like the last commit, but now for manpages. genMan still works with a buffer and returns []byte instead of working directly with an io.Writer. This is because, in turn, md2man takes byte slices instead of readers and writers. Wrapping genMan around a writer is unnecessary especially since it's not an exported function, and also because we'd still need a buffer to get the output bytes.
This commit is contained in:
@ -29,7 +29,9 @@ func TestGenManDoc(t *testing.T) {
|
||||
Section: "2",
|
||||
}
|
||||
// We generate on a subcommand so we have both subcommands and parents
|
||||
GenMan(cmdEcho, header, out)
|
||||
if err := GenMan(cmdEcho, header, out); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
found := out.String()
|
||||
|
||||
// Make sure parent has - in CommandPath() in SEE ALSO:
|
||||
@ -85,7 +87,9 @@ func TestGenManNoGenTag(t *testing.T) {
|
||||
Section: "2",
|
||||
}
|
||||
// We generate on a subcommand so we have both subcommands and parents
|
||||
GenMan(cmdEcho, header, out)
|
||||
if err := GenMan(cmdEcho, header, out); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
found := out.String()
|
||||
|
||||
unexpected := translate("#HISTORY")
|
||||
|
Reference in New Issue
Block a user