cmd/lncli: [describegraph] -- if rendering fails, display error
This commit is contained in:
parent
a5d2dbf219
commit
3aaf291409
@ -918,18 +918,29 @@ func drawChannelGraph(graph *lnrpc.ChannelGraph) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var errBuffer bytes.Buffer
|
||||||
|
|
||||||
// Once our dot file has been written to disk, we can use the dot
|
// Once our dot file has been written to disk, we can use the dot
|
||||||
// command itself to generate the drawn rendering of the graph
|
// command itself to generate the drawn rendering of the graph
|
||||||
// described.
|
// described.
|
||||||
drawCmd := exec.Command("dot", "-T"+"svg", "-o"+imageFile.Name(),
|
drawCmd := exec.Command("dot", "-T"+"svg", "-o"+imageFile.Name(),
|
||||||
tempDotFile.Name())
|
tempDotFile.Name())
|
||||||
|
drawCmd.Stderr = &errBuffer
|
||||||
if err := drawCmd.Run(); err != nil {
|
if err := drawCmd.Run(); err != nil {
|
||||||
|
fmt.Println("error rendering graph: ", errBuffer.String())
|
||||||
|
fmt.Println("dot: ", graphDotString)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
errBuffer.Reset()
|
||||||
|
|
||||||
// Finally, we'll open the drawn graph to display to the user.
|
// Finally, we'll open the drawn graph to display to the user.
|
||||||
openCmd := exec.Command("open", imageFile.Name())
|
openCmd := exec.Command("open", imageFile.Name())
|
||||||
|
openCmd.Stderr = &errBuffer
|
||||||
if err := openCmd.Run(); err != nil {
|
if err := openCmd.Run(); err != nil {
|
||||||
|
fmt.Println("error opening rendered graph image: ",
|
||||||
|
errBuffer.String())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user