Graphviz Issue Tracker
Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001686graphvizOtherpublic2009-08-06 10:492011-04-28 04:03
Assigned Toerg 
PlatformOSx86-Windows-XP SP3OS Version
Summary0001686: sccmap output not redirected when called from .NET


I tried the sccmap.exe utilitity using the following command line from cmd.exe:
sccmap > file.out
This writes the output to file.out instead of stdout.

Then I needed to call it from my .NET 3.5 program. So I wrote this code
and it does not work; the output is not redirected, everything is written
to console and the output file is empty. Using
Process.StartInfo.RedirectStandartOutput does not work either.

Thanks for solving it.

using (Process myProcess = new Process())
                    string inf = Path.GetTempFileName();
                    string outf = Path.GetTempFileName();

                    File.WriteAllText(inf, dotSource); // dotSource is the source code of the graph

                    myProcess.StartInfo.FileName = Path.Combine( PortalUtils.graphvizDir, "bin\\dot.exe"); // graphvizDir is the directory in which graphviz is located
                    myProcess.StartInfo.CreateNoWindow = true;
                    myProcess.StartInfo.Arguments = string.Format("-T{0} \"{1}\" -o \"{2}\"", target, inf, outf);
                    // wait for the process to finish
                    while (!myProcess.WaitForExit(1000)) ;
                    // investigate whether the exit code was fine
                    if (myProcess.ExitCode != 0)
                        throw new Exception("The call to dot.exe failed.");

                    return File.ReadAllText(outf);
Additional Information

This is not really a bug but a feature request. If you check the man page, sccmap does not
accept the -o flag. Indeed, if you had run sccmap -o file.out instead of redirecting
the output, you would have found that the output also went to stdout.

Your .NET example show dot being used, not sccmap.

The -o option as been added, and will appear in tomorrow's packages. As a workaround, you would
have to have .NET redirect stdout to your output file.
TagsNo tags attached.
STATUS-COMMENTFixed (7 Aug 2009)
VERSION     2.24
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2011-04-28 04:03 user1 New Issue
2011-04-28 04:03 user1 Assigned To => erg

MantisBT 1.2.5[^]
Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker