mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-07 22:58:34 +02:00
Hooks
- Implemented ::onExit.
This commit is contained in:
parent
398bec3dbe
commit
8f14d83955
1 changed files with 11 additions and 6 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue