forked from OSchip/llvm-project
[GraphWriter] Don't wait on xdg-open when not on Apple.
By default, the GraphWriter code assumes that the generic file open program (`open` on Apple, `xdg-open` on other systems) can wait on the forked proces to complete. When the fork ends, the code would delete the temporary dot files created, and return. On GNU/Linux, the xdg-open program does not have a "wait for your fork to complete before dying" option. So the behaviour was that xdg-open would launch a process, quickly die itself, and then the GraphWriter code would think its OK to quickly delete all the temporary files. Once the temporary files were deleted, the dot viewers would get very upset, and often give you weird errors. This change only waits on the generic open program on Apple platforms. Elsewhere, we don't wait on the process, and hence we don't try and clean up the temporary files. llvm-svn: 241250
This commit is contained in:
parent
5b41ea0d56
commit
0912de3216
|
@ -353,7 +353,7 @@ void ViewGraph(const GraphType &G, const Twine &Name,
|
||||||
if (Filename.empty())
|
if (Filename.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DisplayGraph(Filename, true, Program);
|
DisplayGraph(Filename, false, Program);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
|
@ -135,12 +135,12 @@ static const char *getProgramName(GraphProgram::Name program) {
|
||||||
bool llvm::DisplayGraph(StringRef FilenameRef, bool wait,
|
bool llvm::DisplayGraph(StringRef FilenameRef, bool wait,
|
||||||
GraphProgram::Name program) {
|
GraphProgram::Name program) {
|
||||||
std::string Filename = FilenameRef;
|
std::string Filename = FilenameRef;
|
||||||
wait &= !ViewBackground;
|
|
||||||
std::string ErrMsg;
|
std::string ErrMsg;
|
||||||
std::string ViewerPath;
|
std::string ViewerPath;
|
||||||
GraphSession S;
|
GraphSession S;
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
wait &= !ViewBackground;
|
||||||
if (S.TryFindProgram("open", ViewerPath)) {
|
if (S.TryFindProgram("open", ViewerPath)) {
|
||||||
std::vector<const char *> args;
|
std::vector<const char *> args;
|
||||||
args.push_back(ViewerPath.c_str());
|
args.push_back(ViewerPath.c_str());
|
||||||
|
|
Loading…
Reference in New Issue