[comp.unix.aix] AIX 3.1, script and intr

abe@mace.cc.purdue.edu (Vic Abell) (08/08/90)

Does anyone know how to keep the intr character (^C in may case) from
terminating script?

karish@mindcrf.UUCP (08/10/90)

In article <5289@mace.cc.purdue.edu> abe@mace.cc.purdue.edu (Vic Abell) writes:
>Does anyone know how to keep the intr character (^C in may case) from
>terminating script?

For sh or ksh:

    trap "" 2
-- 

	Chuck Karish		karish@mindcraft.com
	Mindcraft, Inc.		(415) 323-9000		

abe@mace.cc.purdue.edu (Vic Abell) (08/10/90)

In article <9008100210.AA23730@mindcrf.mindcraft.com> karish@mindcrf.UUCP writes:
>In article <5289@mace.cc.purdue.edu> abe@mace.cc.purdue.edu (Vic Abell) writes:
>>Does anyone know how to keep the intr character (^C in my case) from
>>terminating script?
>
>For sh or ksh:
>
>    trap "" 2

I guess I wasn't clear enough in my original posting.  I was not asking how
to protect shell scripts; I was asking how to protect the script(1) program
from terminating when I type an intr character to a program whose output
I am capturing in a file via script(1).

karish@mindcrf.UUCP (Chuck Karish) (08/15/90)

In article <5306@mace.cc.purdue.edu> abe@mace.cc.purdue.edu (Vic Abell) writes:
>In article <9008100210.AA23730@mindcrf.mindcraft.com>
>karish@mindcrf.UUCP writes:
>>In article <5289@mace.cc.purdue.edu> abe@mace.cc.purdue.edu (Vic Abell)
>>writes:
>>>Does anyone know how to keep the intr character (^C in my case) from
>>>terminating script?

>>For sh or ksh:
>>    trap "" 2

>I guess I wasn't clear enough in my original posting.  I was not asking how
>to protect shell scripts; I was asking how to protect the script(1) program
>from terminating when I type an intr character to a program whose output
>I am capturing in a file via script(1).

The answer is the same.  Type `trap "" 2' to your interactive sh or ksh
before invoking `script'.  If your shell is ignoring a signal, its
child will ignore it, too.

The `onintr' directive to csh doesn't seem to have an option to cause
the shell to ignore one signal.  `onintr -', though, will cause it (and
its child, the `script' process) to ignore ALL signals, including
SIGINT.  This will make it more complicated to recover control of your
display if your application hangs.

-- 

	Chuck Karish		karish@mindcraft.com
	Mindcraft, Inc.		(415) 323-9000		

abe@mace.cc.purdue.edu (Vic Abell) (08/15/90)

In article <9008142356.AA07620@mindcrf.mindcraft.com>, karish@mindcrf.UUCP (Chuck Karish) writes:
> In article <5306@mace.cc.purdue.edu> abe@mace.cc.purdue.edu (Vic Abell) writes:
> >In article <9008100210.AA23730@mindcrf.mindcraft.com>
> >karish@mindcrf.UUCP writes:
> >>In article <5289@mace.cc.purdue.edu> abe@mace.cc.purdue.edu (Vic Abell)
> >>writes:
> >>>Does anyone know how to keep the intr character (^C in my case) from
> >>>terminating script?
> 
> The answer is the same.  Type `trap "" 2' to your interactive sh or ksh
> before invoking `script'.  If your shell is ignoring a signal, its
> child will ignore it, too.

This works.
 
> The `onintr' directive to csh doesn't seem to have an option to cause
> the shell to ignore one signal.  `onintr -', though, will cause it (and
> its child, the `script' process) to ignore ALL signals, including
> SIGINT.  This will make it more complicated to recover control of your
> display if your application hangs.


This does not work.  Interactive csh rejects onintr with the message"

	"onintr: Can't from terminal."

A solution that doesn't allow the intr character to be used during a script
session isn't very attractive, however.  The point of wanting to use intr,
especially when scripting a bug's behavior, is to be able to better control
the session.  Since other script programs I have used do handle intr
properly, it appears that IBM has modified the AIX 3.1 script in some way
that has diminished its usefulness for bug reporting.

dcm@toysrus.uucp (dcm) (08/15/90)

In article <9008142356.AA07620@mindcrf.mindcraft.com> karish@mindcrf.UUCP (Chuck Karish) writes:
>In article <5306@mace.cc.purdue.edu> abe@mace.cc.purdue.edu (Vic Abell) writes:
>>In article <9008100210.AA23730@mindcrf.mindcraft.com>
>>karish@mindcrf.UUCP writes:
>>>In article <5289@mace.cc.purdue.edu> abe@mace.cc.purdue.edu (Vic Abell)
>>>writes:
>>>>Does anyone know how to keep the intr character (^C in my case) from
>>>>terminating script?
>
>The answer is the same.  Type `trap "" 2' to your interactive sh or ksh
>before invoking `script'.  If your shell is ignoring a signal, its
>child will ignore it, too.


	Sure, this will keep script from terminating from SIGINT, but also
	keep any children of script from terminating.

	Script on AIXV3 is broke.  It's not setting the correct modes.

	Matter of fact, I'm going to fix it in the next week or two.
	It should be out on a future update.

		Craig Miller, AIXV3 Change Team, Austin
--------
	Craig Miller, contractor @ IBM AWD, Austin
	UUCP: ..!uunet!cs.utexas.edu!ibmaus!auschs!toysrus.austin.ibm.com!dcm

	"Just because it works doesn't means it's right, stupid!"
	"You should never install code you do not understand."
	"If you knowningly install broken code, you should be shot.  Period."
	"Programmers have to be accountable for their code."

guy@auspex.auspex.com (Guy Harris) (08/16/90)

>>I guess I wasn't clear enough in my original posting.  I was not asking how
>>to protect shell scripts; I was asking how to protect the script(1) program
>>from terminating when I type an intr character to a program whose output
>>I am capturing in a file via script(1).
>
>The answer is the same.

If the problem is that the user typed "script" and ran some program, and
then typed ^C to interrupt the program, only to have "script" itself
exit, the answer *should* be "oops, sorry, IBM screwed up; fixed in the
next release."

"script" - if it's the thingie that snarfs a pseudo-tty and runs a new
shell within that pseudo-tty, capturing and logging all terminal output
- shouldn't exit just because you type ^C at it!  It's supposed to *turn
off* special-character processing on the terminal from which it's run,
including processing of the interrupt and quit characters, and just
shove stuff down the aforementioned pseudo-tty.  What the tty driver or
the application do with those characters is their business.