[PATCH] D59707: On Mac, try use commandline tools first instead of 'open' for dot files
Yuanfang Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 22 10:37:23 PDT 2019
tabloid.adroit created this revision.
tabloid.adroit added reviewers: MatzeB, chandlerc.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
It's a hassle[1] to use 'open' on Mac to open dot files since it requires an application be installed. Better try commandline tools first, and resort to 'open' as the backup.
[1] brew does not provide graphviz app anymore.
https://github.com/Homebrew/homebrew-core/issues/31510
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D59707
Files:
llvm/lib/Support/GraphWriter.cpp
Index: llvm/lib/Support/GraphWriter.cpp
===================================================================
--- llvm/lib/Support/GraphWriter.cpp
+++ llvm/lib/Support/GraphWriter.cpp
@@ -152,19 +152,6 @@
std::string ViewerPath;
GraphSession S;
-#ifdef __APPLE__
- wait &= !ViewBackground;
- if (S.TryFindProgram("open", ViewerPath)) {
- std::vector<StringRef> args;
- args.push_back(ViewerPath);
- if (wait)
- args.push_back("-W");
- args.push_back(Filename);
- errs() << "Trying 'open' program... ";
- if (!ExecGraphViewer(ViewerPath, args, Filename, wait, ErrMsg))
- return false;
- }
-#endif
if (S.TryFindProgram("xdg-open", ViewerPath)) {
std::vector<StringRef> args;
args.push_back(ViewerPath);
@@ -197,6 +184,20 @@
return ExecGraphViewer(ViewerPath, args, Filename, wait, ErrMsg);
}
+#ifdef __APPLE__
+ wait &= !ViewBackground;
+ if (S.TryFindProgram("open", ViewerPath)) {
+ std::vector<StringRef> args;
+ args.push_back(ViewerPath);
+ if (wait)
+ args.push_back("-W");
+ args.push_back(Filename);
+ errs() << "Trying 'open' program... ";
+ if (!ExecGraphViewer(ViewerPath, args, Filename, wait, ErrMsg))
+ return false;
+ }
+#endif
+
enum ViewerKind {
VK_None,
VK_OSXOpen,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59707.191908.patch
Type: text/x-patch
Size: 1286 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190322/993c2fac/attachment.bin>
More information about the llvm-commits
mailing list