Fix "tee" handling of log_streams
authorClifford Wolf <clifford@clifford.at>
Fri, 31 May 2019 07:28:51 +0000 (09:28 +0200)
committerClifford Wolf <clifford@clifford.at>
Fri, 31 May 2019 07:28:51 +0000 (09:28 +0200)
Signed-off-by: Clifford Wolf <clifford@clifford.at>
passes/cmds/tee.cc

index ee96ace867c712213f4b81e9ada03d8fe17e6ffa..1a44bdaecbdc08bbc3a1973a79337026057ab9e4 100644 (file)
@@ -52,7 +52,9 @@ struct TeePass : public Pass {
        void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
        {
                std::vector<FILE*> backup_log_files, files_to_close;
+               std::vector<std::ostream*> backup_log_streams;
                int backup_log_verbose_level = log_verbose_level;
+               backup_log_streams = log_streams;
                backup_log_files = log_files;
 
                size_t argidx;
@@ -60,6 +62,7 @@ struct TeePass : public Pass {
                {
                        if (args[argidx] == "-q" && files_to_close.empty()) {
                                log_files.clear();
+                               log_streams.clear();
                                continue;
                        }
                        if ((args[argidx] == "-o" || args[argidx] == "-a") && argidx+1 < args.size()) {
@@ -89,6 +92,7 @@ struct TeePass : public Pass {
                        for (auto cf : files_to_close)
                                fclose(cf);
                        log_files = backup_log_files;
+                       log_streams = backup_log_streams;
                        throw;
                }
 
@@ -97,6 +101,7 @@ struct TeePass : public Pass {
 
                log_verbose_level = backup_log_verbose_level;
                log_files = backup_log_files;
+               log_streams = backup_log_streams;
        }
 } TeePass;