- Applied large patch to make task return meaningful exit codes.
- Added unit tests to prove this.
- Thanks to Pietro Cerutti.
This commit is contained in:
Paul Beckingham
2009-08-29 09:14:26 -04:00
parent cc5c99c0a1
commit 62be3f8acb
11 changed files with 302 additions and 157 deletions

View File

@@ -52,7 +52,7 @@ static std::vector <std::string> customReports;
////////////////////////////////////////////////////////////////////////////////
// This report will eventually become the one report that many others morph into
// via the .taskrc file.
std::string handleCustomReport (const std::string& report)
int handleCustomReport (const std::string& report, std::string &outs)
{
// Load report configuration.
std::string columnList = context.config.get ("report." + report + ".columns");
@@ -94,21 +94,24 @@ std::string handleCustomReport (const std::string& report)
labelList,
sortList,
filterList,
tasks);
tasks,
outs);
}
////////////////////////////////////////////////////////////////////////////////
// This report will eventually become the one report that many others morph into
// via the .taskrc file.
std::string runCustomReport (
int runCustomReport (
const std::string& report,
const std::string& columnList,
const std::string& labelList,
const std::string& sortList,
const std::string& filterList,
std::vector <Task>& tasks)
std::vector <Task>& tasks,
std::string &outs)
{
int rc = 0;
// Load report configuration.
std::vector <std::string> columns;
split (columns, columnList, ',');
@@ -547,11 +550,14 @@ std::string runCustomReport (
<< table.rowCount ()
<< (table.rowCount () == 1 ? " task" : " tasks")
<< std::endl;
else
else {
out << "No matches."
<< std::endl;
rc = 1;
}
return out.str ();
outs = out.str ();
return rc;
}
////////////////////////////////////////////////////////////////////////////////