- Implemented ::onExit.
This commit is contained in:
Paul Beckingham 2014-05-14 00:05:22 -04:00
parent 398bec3dbe
commit 8f14d83955

View file

@ -119,18 +119,23 @@ void Hooks::onExit ()
std::vector <std::string>::iterator i; std::vector <std::string>::iterator i;
for (i = _scripts.begin (); i != _scripts.end (); ++i) for (i = _scripts.begin (); i != _scripts.end (); ++i)
{ {
if (i->substr (0, 7) == "on-exit") if (i->find ("/on-exit") != std::string::npos)
{ {
File script (*i); File script (*i);
if (script.executable ()) if (script.executable ())
{ {
// TODO Call all exit hook scripts. std::string output;
int status = execute (*i, "", output);
// TODO On zero status: std::vector <std::string> lines;
// - all stdout --> context.footnote split (lines, output, '\n');
std::vector <std::string>::iterator line;
// TODO On non-zero status: for (line = lines.begin (); line != lines.end (); ++line)
// - all stdout --> context.error if (status == 0)
context.footnote (*line);
else
context.error (*line);
} }
} }
} }