aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/GraphWriter.cpp
diff options
context:
space:
mode:
authorCharlie Turner <charlie.turner@arm.com>2015-07-02 09:32:07 +0000
committerCharlie Turner <charlie.turner@arm.com>2015-07-02 09:32:07 +0000
commit0912de3216b3b9cfe187816f7d7bc8fc2cb64dc3 (patch)
tree953b25eeea4a0f0bdc41db5d1f6842a9b07077e1 /llvm/lib/Support/GraphWriter.cpp
parent5b41ea0d566e635e45229e0baa414a125783ca40 (diff)
downloadllvm-0912de3216b3b9cfe187816f7d7bc8fc2cb64dc3.zip
llvm-0912de3216b3b9cfe187816f7d7bc8fc2cb64dc3.tar.gz
llvm-0912de3216b3b9cfe187816f7d7bc8fc2cb64dc3.tar.bz2
[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
Diffstat (limited to 'llvm/lib/Support/GraphWriter.cpp')
-rw-r--r--llvm/lib/Support/GraphWriter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/GraphWriter.cpp b/llvm/lib/Support/GraphWriter.cpp
index 97aedc8..a9b0220 100644
--- a/llvm/lib/Support/GraphWriter.cpp
+++ b/llvm/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<const char *> args;
args.push_back(ViewerPath.c_str());