diff options
author | Miodrag Milanović <mmicko@gmail.com> | 2019-09-23 20:06:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-23 20:06:40 +0200 |
commit | 057dae4f78ef604964fb12175f5b263bb386da24 (patch) | |
tree | 66cb90b76da1b234d471d9dd1e86d8784868e5e8 /passes/cmds/show.cc | |
parent | 0a2d8db793fee47d8237c472c1d2d5ca4e21f865 (diff) | |
parent | 2b81ce5648f4052ff55adc1f1b297d5975b965fa (diff) | |
download | yosys-057dae4f78ef604964fb12175f5b263bb386da24.tar.gz yosys-057dae4f78ef604964fb12175f5b263bb386da24.tar.bz2 yosys-057dae4f78ef604964fb12175f5b263bb386da24.zip |
Merge pull request #1399 from nakengelhardt/fix-show-macos
fix show command for macos
Diffstat (limited to 'passes/cmds/show.cc')
-rw-r--r-- | passes/cmds/show.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/passes/cmds/show.cc b/passes/cmds/show.cc index 2e9fc72af..a3e969ef1 100644 --- a/passes/cmds/show.cc +++ b/passes/cmds/show.cc @@ -26,6 +26,10 @@ # include <dirent.h> #endif +#ifdef __APPLE__ +# include <unistd.h> +#endif + #ifdef YOSYS_ENABLE_READLINE # include <readline/readline.h> #endif @@ -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"); |