Hi,

Recently my company has removed contact to [EMAIL PROTECTED]<mailto:[EMAIL 
PROTECTED]>.  My email address is [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>.  
I believe [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]> is the email address in 
ast-users.

Could someone kindly reply that you have seen this posting.

Thanks,

Mike Nemeth
Global Engineering Systems

[EMAIL PROTECTED]
* Office  610 712 8106
* Cell      610 653 8847



________________________________
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nemeth, Michael 
Kenneth (Mike)
Sent: Monday, October 06, 2008 10:05 AM
To: [email protected]
Subject: [ast-users] Ksh93 s+: SIGINT handling when trap EXIT

Hi,

I'm seeing different behavior in parent process SIGINT handling when parent has 
a trap set for EXIT and run from current shell vs. sub shell.  Hoping that 
someone can comment if this is the correct behavior for ksh93 or a software 
bug.  If a software bug what is the correct workaround. Would it be to set a 
trap on SIGINT in the parent to ignore (i.e. trap '' SIGINT).   Details on my 
issue follow:

Sample Test Program

/* Program compiled
   Linux pacelab2 2.6.9-67.ELsmp #1 SMP Wed Nov 7 13:56:44 EST 2007 x86_64 
x86_64 x86_64 GNU/Linux
      command line  gcc sysInt.c -o sysInt
*/
#include <signal.h>
#include <errno.h>

void myfunc(int sig)
{
    printf("Received %d\n",sig);
}

main ()
{
    char s[1024];
    sigset(SIGINT,myfunc);
    sigset(SIGQUIT,myfunc);
    printf("Started sysInt\n");
    while(1)
    {
        s[0] = '\0';
        fgets(s,1023,stdin);
        printf("Read %s\n",s);
        if ((errno != EINTR) && (s[0] == '\0')){  printf("parent 
died\n");exit(1); }
        if (strstr(s,"stop") != 0) exit(0);
    }
}


1. When the sysInt program is run in current shell and not from subshell script 
it works fine.

$ echo ${.sh.version}
Version M 1993-12-28 s+

$ trap 'echo exit' EXIT
$ ./sysInt
Started sysInt
I hit ^C
Received 2
Read
I hit ^C
Received 2
Read
I hit ^C
Received 2
Read
I type stop
Read stop

$

2. When program is run from a subshell script it doesn't work.

$ echo ${.sh.version}
Version M 1993-12-28 s+

$ cat sysInt.sh
trap 'echo exit' EXIT
./sysInt

$ sysInt.sh
Started sysInt
I hit ^C
exit
Received 2
Read
$ Read
Read
parent died

_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to