aboutsummaryrefslogtreecommitdiffstats
path: root/passes/cmds
diff options
context:
space:
mode:
authorWilliam D. Jones <thor0505@comcast.net>2018-08-15 17:15:44 -0400
committerWilliam D. Jones <thor0505@comcast.net>2018-08-15 17:18:19 -0400
commit9f91c62348c533d0d0d167a393bab284b2c6de8d (patch)
treefd8476e8f1f026aaa756f58fa79deee4bbbbf8df /passes/cmds
parentce3dc3e01d288a8e545fb5fd24a2a06d205c6b0d (diff)
downloadyosys-9f91c62348c533d0d0d167a393bab284b2c6de8d.tar.gz
yosys-9f91c62348c533d0d0d167a393bab284b2c6de8d.tar.bz2
yosys-9f91c62348c533d0d0d167a393bab284b2c6de8d.zip
Fix run_command() when using -format and -viewer in show pass.
Diffstat (limited to 'passes/cmds')
-rw-r--r--passes/cmds/show.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/passes/cmds/show.cc b/passes/cmds/show.cc
index ec04418fa..fa88cd668 100644
--- a/passes/cmds/show.cc
+++ b/passes/cmds/show.cc
@@ -817,14 +817,30 @@ struct ShowPass : public Pass {
log_cmd_error("Nothing there to show.\n");
if (format != "dot" && !format.empty()) {
- std::string cmd = stringf("dot -T%s '%s' > '%s.new' && mv '%s.new' '%s'", format.c_str(), dot_file.c_str(), out_file.c_str(), out_file.c_str(), out_file.c_str());
+ #ifdef _WIN32
+ // system()/cmd.exe does not understand single quotes on Windows.
+ #define DOT_CMD "dot -T%s \"%s\" > \"%s.new\" && move \"%s.new\" \"%s\""
+ #else
+ #define DOT_CMD "dot -T%s '%s' > '%s.new' && mv '%s.new' '%s'"
+ #endif
+ std::string cmd = stringf(DOT_CMD, format.c_str(), dot_file.c_str(), out_file.c_str(), out_file.c_str(), out_file.c_str());
+ #undef DOT_CMD
log("Exec: %s\n", cmd.c_str());
if (run_command(cmd) != 0)
log_cmd_error("Shell command failed!\n");
}
if (!viewer_exe.empty()) {
- std::string cmd = stringf("%s '%s' &", viewer_exe.c_str(), out_file.c_str());
+ #ifdef _WIN32
+ // system()/cmd.exe does not understand single quotes nor
+ // background tasks on Windows. So we have to pause yosys
+ // until the viewer exits.
+ #define VIEW_CMD "%s \"%s\""
+ #else
+ #define VIEW_CMD "%s '%s' &"
+ #endif
+ std::string cmd = stringf(VIEW_CMD, viewer_exe.c_str(), out_file.c_str());
+ #undef VIEW_CMD
log("Exec: %s\n", cmd.c_str());
if (run_command(cmd) != 0)
log_cmd_error("Shell command failed!\n");