diff --git a/cmdnotify.cpp b/cmdnotify.cpp index 3e3d3c2..ea21157 100644 --- a/cmdnotify.cpp +++ b/cmdnotify.cpp @@ -10,6 +10,8 @@ #include #include +#include +#include #include "znc/znc.h" #include "znc/Chan.h" @@ -184,11 +186,16 @@ class CNotifoMod : public CModule { execl("/bin/bash", "-c", options["cmd"].c_str(), cmd.c_str(), NULL); /* tells the child to stop executing this code */ PutIRC("PRIVMSG " + nick.GetNick() + " : Send fail."); + exit(0); /* and start executing pidgin..or w/e you want*/ } else /* parent executes this */ - { } + { + int status; + /* wait for child to complete, or they becomes zombie. */ + waitpid(pid, &status, 0); + } return true; }