Skip to content

Commit

Permalink
fix show command for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
nakengelhardt committed Sep 23, 2019
1 parent 0a2d8db commit 3bed4cb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions passes/cmds/show.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
# include <dirent.h>
#endif

#ifdef __APPLE__
# include <unistd.h>
#endif

#ifdef YOSYS_ENABLE_READLINE
# include <readline/readline.h>
#endif
Expand Down Expand Up @@ -866,7 +870,11 @@ struct ShowPass : public Pass {
log_cmd_error("Shell command failed!\n");
} else
if (format.empty()) {
#ifdef __APPLE__
std::string cmd = stringf("ps -fu %d | grep -q '[ ]%s' || xdot '%s' &", getuid(), dot_file.c_str(), dot_file.c_str());
#else
std::string cmd = stringf("{ test -f '%s.pid' && fuser -s '%s.pid'; } || ( echo $$ >&3; exec xdot '%s'; ) 3> '%s.pid' &", dot_file.c_str(), dot_file.c_str(), dot_file.c_str(), dot_file.c_str());
#endif
log("Exec: %s\n", cmd.c_str());
if (run_command(cmd) != 0)
log_cmd_error("Shell command failed!\n");
Expand Down

0 comments on commit 3bed4cb

Please sign in to comment.