Hooks
- It is now an error for a failing hook script to fail to also generate some feedback. - Updated NEWS file to mention stricter hook script controls.
This commit is contained in:
@@ -144,6 +144,8 @@ void Hooks::onLaunch ()
|
||||
}
|
||||
else
|
||||
{
|
||||
assertFeedback (outputFeedback);
|
||||
|
||||
std::vector <std::string>::iterator message;
|
||||
for (message = outputFeedback.begin (); message != outputFeedback.end (); ++message)
|
||||
context.error (*message);
|
||||
@@ -209,6 +211,8 @@ void Hooks::onExit ()
|
||||
}
|
||||
else
|
||||
{
|
||||
assertFeedback (outputFeedback);
|
||||
|
||||
std::vector <std::string>::iterator message;
|
||||
for (message = outputFeedback.begin (); message != outputFeedback.end (); ++message)
|
||||
context.error (*message);
|
||||
@@ -273,6 +277,8 @@ void Hooks::onAdd (Task& task)
|
||||
}
|
||||
else
|
||||
{
|
||||
assertFeedback (outputFeedback);
|
||||
|
||||
std::vector <std::string>::iterator message;
|
||||
for (message = outputFeedback.begin (); message != outputFeedback.end (); ++message)
|
||||
context.error (*message);
|
||||
@@ -342,6 +348,8 @@ void Hooks::onModify (const Task& before, Task& after)
|
||||
}
|
||||
else
|
||||
{
|
||||
assertFeedback (outputFeedback);
|
||||
|
||||
std::vector <std::string>::iterator message;
|
||||
for (message = outputFeedback.begin (); message != outputFeedback.end (); ++message)
|
||||
context.error (*message);
|
||||
@@ -493,6 +501,22 @@ void Hooks::assertSameTask (const std::vector <std::string>& input, const Task&
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Hooks::assertFeedback (const std::vector <std::string>& input) const
|
||||
{
|
||||
bool foundSomething = false;
|
||||
std::vector <std::string>::const_iterator i;
|
||||
for (i = input.begin (); i != input.end (); ++i)
|
||||
if (nontrivial (*i))
|
||||
foundSomething = true;
|
||||
|
||||
if (! foundSomething)
|
||||
{
|
||||
context.error ("Hook Error: Expected feedback from a failing hook script.");
|
||||
throw 0;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int Hooks::callHookScript (
|
||||
const std::string& script,
|
||||
|
||||
Reference in New Issue
Block a user