[PATCH] [GraphWriter] Don't wait on xdg-open when not on Apple

Charlie Turner charlie.turner at arm.com
Wed Jul 1 10:34:55 PDT 2015


Hi MatzeB, atrick, chandlerc,

Hi,

I could be way off with this patch, but it seems like the waiting behaviour introduced in 255cd51fbd77 (2012) and its use extended by D6534 won’t work on systems using xdg-open, since there’s no option to have xdg-open wait on the application it launches AFAICT, and if there is, then GraphWriter is not making use of it.

What happens on my computer is that xdg-open launches a dot file viewer, then immediately returns, and then the GraphWriter quickly deletes all the temporary dot files, and then the dot viewers get upset, if they even got a chance to launch.

This patch moves the “wait” behaviour to only Apple platforms, where the “open” command actually has a wait option.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10873

Files:
  include/llvm/Support/GraphWriter.h
  lib/Support/GraphWriter.cpp

Index: include/llvm/Support/GraphWriter.h
===================================================================
--- include/llvm/Support/GraphWriter.h
+++ include/llvm/Support/GraphWriter.h
@@ -353,7 +353,7 @@
   if (Filename.empty())
     return;
 
-  DisplayGraph(Filename, true, Program);
+  DisplayGraph(Filename, false, Program);
 }
 
 } // End llvm namespace
Index: lib/Support/GraphWriter.cpp
===================================================================
--- lib/Support/GraphWriter.cpp
+++ lib/Support/GraphWriter.cpp
@@ -135,12 +135,12 @@
 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());

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10873.28880.patch
Type: text/x-patch
Size: 975 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150701/499195d3/attachment.bin>


More information about the llvm-commits mailing list