signal(TCL)
signal --
specify action to take when Tcl is signalled by UNIX
Syntax
signal action siglist [command]
Description
Specifies the action to take when a UNIX signal is received by Extended
Tcl, or a program that embeds it. siglist is a list
of either the symbolic or numeric UNIX signal (the ``SIG''
prefix is optional).
action is one of the following actions to be performed on receipt of the
signal. To specify all modifiable signals, use ``'' (this does not
include SIGKILL or SIGSTOP as these cannot be
modified).
default-
Performs system default action when signal is received
(see signal system call documentation).
ignore-
Ignores the signal.
error-
Generates a catchable Tcl error. It is as if the command
that was running returned an error. The error code is in the form:
POSIX SIG signame
For the death of child signal, signame is always
SIGCHLD, rather than SIGCLD, to allow writing portable code.
trap-
When the signal occurs, executes command and continue
execution if an error is not returned by command. The command will
be executed in the global context. The command is edited before
execution, replacing occurrences of ``%S'' with the signal name.
Occurrences of ``%%'' result in a single ``%''.
This editing occurs just before the trap command is evaluated.
If an error is returned,
then follow the standard Tcl error mechanism.
Often command simply exits.
get-
Retrieves the current settings of the specified signals. A keyed
list is returned where the keys are one of the specified signals. The
values are a list consisting of the action associated with the signal:
a 0 value if the signal may be delivered (not blocked) and a 1 if it can
be
blocked. The actions may be one of default, ignore,
error or trap. For example, if the action is
trap,
then the third element is the command associated with the action.
set-
Sets the signals from a keyed list in the format returned by the get command. For this action, siglist is the keyed list of signal states.
Signals with an action of unknown are not modified.
block-
Blocks the specified signals from being received. (POSIX systems only).
unblock-
Allows the specified signal to be received. Pending signals
do not occur. (POSIX systems only.)
The signal action is enabled after the specified signal has occurred.
The exception to this is SIGCHLD on systems without POSIX
signals.
For these systems, SIGCHLD is not automatically re-enabled. After a
SIGCHLD signal is received, a call to wait must be
performed to retrieve the exit status of the child process before issuing
another signal SIGCHLD ... command.
For code that is to be portable
between both types of systems, use this approach.
Signals are not processed until after the completion of the Tcl command that
is executing when the signal is received. If an interactive Tcl shell is
running, then the SIGINT is set to error;
non-interactive
Tcl sessions leave SIGINT unchanged from when the process started
(normally default for foreground processes and ignore for
processes in the background).
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003