[GraphWriter] Don't wait on xdg-open when not on Apple.
authorCharlie Turner <charlie.turner@arm.com>
Thu, 2 Jul 2015 09:32:07 +0000 (09:32 +0000)
committerCharlie Turner <charlie.turner@arm.com>
Thu, 2 Jul 2015 09:32:07 +0000 (09:32 +0000)
commit8992bae9908119a221eacede1f58b5d1d0190afc
tree8cf4fe34632a91edcea93003d0db7f2810676082
parentf1b26fc0d0261cf31a0229d9cea762ebf79a9787
[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
include/llvm/Support/GraphWriter.h
lib/Support/GraphWriter.cpp