From 3aaf2914094d91161d788dc596f6c9a4589f94d9 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 25 Jan 2017 18:29:24 -0800 Subject: [PATCH] cmd/lncli: [describegraph] -- if rendering fails, display error --- cmd/lncli/commands.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/lncli/commands.go b/cmd/lncli/commands.go index 1df1a6d0..4368d0a1 100644 --- a/cmd/lncli/commands.go +++ b/cmd/lncli/commands.go @@ -918,18 +918,29 @@ func drawChannelGraph(graph *lnrpc.ChannelGraph) error { return err } + var errBuffer bytes.Buffer + // Once our dot file has been written to disk, we can use the dot // command itself to generate the drawn rendering of the graph // described. drawCmd := exec.Command("dot", "-T"+"svg", "-o"+imageFile.Name(), tempDotFile.Name()) + drawCmd.Stderr = &errBuffer if err := drawCmd.Run(); err != nil { + fmt.Println("error rendering graph: ", errBuffer.String()) + fmt.Println("dot: ", graphDotString) + return err } + errBuffer.Reset() + // Finally, we'll open the drawn graph to display to the user. openCmd := exec.Command("open", imageFile.Name()) + openCmd.Stderr = &errBuffer if err := openCmd.Run(); err != nil { + fmt.Println("error opening rendered graph image: ", + errBuffer.String()) return err }