Skip to content
Snippets Groups Projects
Commit 2c0576c5 authored by Jason Hiser's avatar Jason Hiser :tractor:
Browse files

support stop/dump before/after

Former-commit-id: 3d0a4546340821dae1baa049ac6426b8ec60face
parent 2db0511a
No related branches found
No related tags found
No related merge requests found
......@@ -1328,12 +1328,14 @@ void FileIR_t::GarbageCollectICFS()
}
}
/*
int unused_icfs = this->GetAllICFS().size() - used_icfs.size();
if (unused_icfs > 0)
{
cerr << "FileIR_t::GarbageCollectICFS(): WARNING: " << dec << unused_icfs << " unused ICFS found. ";
cerr << "Deleting before committing to IRDB" << endl;
}
*/
ICFSSet_t to_erase;
for(ICFSSet_t::const_iterator it=this->GetAllICFS().begin();
......
......@@ -22,6 +22,7 @@ ofstream thanos_log;
ostream *real_cout;
ostream *real_cerr;
string thanos_path;
bool redirect_opt=true;
class ThanosPlugin_t
{
......@@ -65,8 +66,6 @@ const unique_ptr<IRDBObjects_t> ThanosPlugin_t::shared_objects(new IRDBObjects_t
using PluginList_t = vector<unique_ptr<ThanosPlugin_t>>;
PluginList_t getPlugins(const int argc, char const *const argv[]);
int main(int argc, char* argv[])
{
thanos_path=argv[0];
......@@ -83,14 +82,31 @@ int main(int argc, char* argv[])
exit(1);
}
// get plugins
auto thanos_plugins = getPlugins(argc-1, argv+1);
auto argv_iter=1;
while (true)
{
if(argv_iter >= argc)
{
break;
}
if(string(argv[argv_iter])=="--no-redirect")
{
redirect_opt=false;
argv_iter++;
}
else
break;
}
const auto plugin_argv_iter=argv_iter;
auto thanos_plugins = getPlugins(argc-plugin_argv_iter, argv+plugin_argv_iter);
if(thanos_plugins.size() == 0)
{
// for now, usage is pretty strict to enable simple
// parsing, because this program is only used by an
// automated script
thanos_log << "Syntax error in arguments." << endl;
thanos_log << "USAGE: (\"<step name> [-optional] [--step-args [ARGS]]\")+" << endl;
thanos_log << "USAGE: <thanos opts> (\"<step name> [-optional] [--step-args [ARGS]]\")+" << endl;
return 1;
}
......@@ -234,8 +250,11 @@ int ThanosPlugin_t::runPlugin()
*real_cout<<"Cannot open log file "<<logfile_path<<endl;
exit(1);
}
cout.rdbuf(logfile.rdbuf());
cerr.rdbuf(logfile.rdbuf());
if(redirect_opt)
{
cout.rdbuf(logfile.rdbuf());
cerr.rdbuf(logfile.rdbuf());
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment