Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

throw error if dot command fails #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

.vs
*.user
*.suo
/DependencyViewer.Common/bin/
Expand Down
1 change: 0 additions & 1 deletion DependencyViewer.Common/Graphing/QuickGraphProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ private void CreateGraph()
private string GenerateDot()
{
var graphviz = new GraphvizAlgorithm<int, IEdge<int>>(_graph);
graphviz.GraphFormat.Size = new Size(100, 100);
graphviz.GraphFormat.Ratio = GraphvizRatioMode.Auto;
graphviz.FormatVertex += graphviz_FormatVertex;
graphviz.FormatEdge += graphviz_FormatEdge;
Expand Down
4 changes: 4 additions & 0 deletions DependencyViewer/GraphVizService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public void ExecGraphViz(string dotFile, string outputFilename)
if(fi.Exists == false) throw new ArgumentException("dot file does not exist - " + dotFile);

ProcessStartInfo psi = new ProcessStartInfo(Settings.Default.GraphVizPath);
psi.RedirectStandardError = true;
psi.Arguments += "-Tpng";
psi.Arguments += " -o"+outputFilename;
psi.Arguments += " \"" + dotFile + "\"";
Expand All @@ -22,10 +23,13 @@ public void ExecGraphViz(string dotFile, string outputFilename)

Process proc = Process.Start(psi);

string procError = proc.StandardError.ReadToEnd();
if (proc == null)
throw new Exception("Could not run GraphViz");

proc.WaitForExit();
if (procError != "")
throw new Exception(procError);
}
}
}