I'm trying to run twinkle command line from a child process. For example like this:
int hangup() {
write_on_display("line3", " ");
write_on_display("hide_icon", "DIALTONE");
write_on_display("hide_icon", "BACKLIGHT");
int pid = fork();
if (pid == 0) {
int res = execl("/usr/bin/twinkle", " ", "--immediate", "--cmd",
"answerbye", (char *) NULL);
_exit(0);
} else {
perror("hangup");
return 0;
}
return 1;
}
but twinkle becomes zombie:
10020 pts/1 Z+ 0:00 [twinkle] <defunct>
10040 pts/1 Z+ 0:00 [twinkle] <defunct>
10053 pts/1 Z+ 0:00 [twinkle] <defunct>
10064 pts/1 Z+ 0:00 [twinkle] <defunct>
10097 pts/1 Z+ 0:00 [twinkle] <defunct>
10108 pts/1 Z+ 0:00 [twinkle] <defunct>
10130 pts/1 Z+ 0:00 [twinkle] <defunct>
I tried to set signal(SIGCHLD, SIG_IGN); but without success. Actually I think that the child process dies, before twinkle had finished.
Running twinkle from command line like:
twinkle --immediate --call 100
does not make zombie - twinkle closes properly. What I'm missing there?
execl
will not be executed unlessexecl
produces an error. – Fatima