From: Charlie Turner Date: Thu, 2 Jul 2015 09:32:07 +0000 (+0000) Subject: [GraphWriter] Don't wait on xdg-open when not on Apple. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8992bae9908119a221eacede1f58b5d1d0190afc;p=oota-llvm.git [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241250 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/GraphWriter.h b/include/llvm/Support/GraphWriter.h index 7d1c273c988..b1af3d7c263 100644 --- a/include/llvm/Support/GraphWriter.h +++ b/include/llvm/Support/GraphWriter.h @@ -353,7 +353,7 @@ void ViewGraph(const GraphType &G, const Twine &Name, if (Filename.empty()) return; - DisplayGraph(Filename, true, Program); + DisplayGraph(Filename, false, Program); } } // End llvm namespace diff --git a/lib/Support/GraphWriter.cpp b/lib/Support/GraphWriter.cpp index 97aedc88473..a9b02204146 100644 --- a/lib/Support/GraphWriter.cpp +++ b/lib/Support/GraphWriter.cpp @@ -135,12 +135,12 @@ static const char *getProgramName(GraphProgram::Name program) { bool llvm::DisplayGraph(StringRef FilenameRef, bool wait, GraphProgram::Name program) { std::string Filename = FilenameRef; - wait &= !ViewBackground; std::string ErrMsg; std::string ViewerPath; GraphSession S; #ifdef __APPLE__ + wait &= !ViewBackground; if (S.TryFindProgram("open", ViewerPath)) { std::vector args; args.push_back(ViewerPath.c_str());