command[commandpos] = '\0';
//we should now have a valid command
struct ClientSocket *textbot = getTextBot();
+ #ifndef WIN32
pid_t pID = fork();
if (pID == 0) { //We're the child process :D
pID = fork();
if(pID < 0) exit(EXIT_FAILURE);
if(pID != 0) exit(EXIT_SUCCESS);
+ #endif
FILE *fp;
fp = popen(command, "r");
if (fp) {
} else {
reply(getTextBot(), user, "internal bot error - please contact an administrator!");
}
+ #ifndef WIN32
exit(EXIT_FAILURE);
} else if (pID < 0) {
reply(getTextBot(), user, "internal bot error - please contact an administrator!");
//parent bot - continue program
wait(NULL);
}
+ #endif
}