29 TeePass() :
Pass(
"tee",
"redirect command output to file") { }
34 log(
" tee [-q] [-o logfile|-a logfile] cmd\n");
36 log(
"Execute the specified command, optionally writing the commands output to the\n");
37 log(
"specified logfile(s).\n");
40 log(
" Do not print output to the normal destination (console and/or log file)\n");
43 log(
" Write output to this file, truncate if exists.\n");
46 log(
" Write output to this file, append if exists.\n");
51 std::vector<FILE*> backup_log_files, files_to_close;
55 for (argidx = 1; argidx < args.size(); argidx++)
57 if (args[argidx] ==
"-q" && files_to_close.empty()) {
61 if ((args[argidx] ==
"-o" || args[argidx] ==
"-a") && argidx+1 < args.size()) {
62 const char *open_mode = args[argidx] ==
"-o" ?
"w" :
"a+";
63 FILE *f = fopen(args[++argidx].c_str(), open_mode);
65 for (
auto cf : files_to_close)
67 log_cmd_error(
"Can't create file %s.\n", args[argidx].c_str());
70 files_to_close.push_back(f);
77 std::vector<std::string> new_args(args.begin() + argidx, args.end());
80 for (
auto cf : files_to_close)
86 for (
auto cf : files_to_close)
virtual void execute(std::vector< std::string > args, RTLIL::Design *design)
YOSYS_NAMESPACE_BEGIN std::vector< FILE * > log_files
#define PRIVATE_NAMESPACE_BEGIN
#define PRIVATE_NAMESPACE_END
void log_cmd_error(const char *format,...)
#define USING_YOSYS_NAMESPACE
void log(const char *format,...)
static void call(RTLIL::Design *design, std::string command)