Beispiel #1
0
/*++++++++++++++++++++++++++++ kill_child() +++++++++++++++++++++++++++++*/
static void
kill_child(Widget w)
{
   if (cmd_pid > 0)
   {
      pid_t pid = cmd_pid;

      XtRemoveInput(cmd_input_id);
      cmd_input_id = 0L;
      if (kill(pid, SIGINT) == -1)
      {
         (void)fprintf(stderr,
#if SIZEOF_PID_T == 4
                       "Failed to kill() process %d : %s (%s %d)\n",
#else
                       "Failed to kill() process %lld : %s (%s %d)\n",
#endif
                       (pri_pid_t)cmd_pid, strerror(errno), __FILE__, __LINE__);
      }
      else
      {
         catch_child(cmd_output);
      }
   }

   return;
}
END_TEST

START_TEST(test_catch_child_1)
  {
  termin_child = 0;
  catch_child(2);
  fail_unless(termin_child == 1, "termin_child is set to 1 by this method");
  }