October 29, 2008

Cruelest code ever

void ExecWithIO::kill_child()
{
  if (running() > 0) {
   int status = kill(child_pid, SIGKILL);
   if (status < 0) {
    std::cerr << "error " << strerror(errno) << " (" << errno
    << ") killing " << child_pid << std::endl;
    }
  }
}

//Just received the code from my supervisor - it has to deal with piping or smthn, but essentialy this method just got me rofling for a while :).

No comments: