Name
trap
- trap
[
options
] [[command
]signal-list
] Set exception handling behavior. The command command will be executed when any of the signals in the list
signal-list
occurs.The command can be a Tcl command or the special values
SIG_IGN
(ignore) orSIG_DFL
(use default action). The signals can be specified by number or name.
Options
- -code
Use return code of the handler command.
- -interp
Evaluate command using the context active at the time of exception.
- -name
Return signal name of the trap command currently being executed.
- -max
Return highest available signal number.
- Example
trap {send_user "Control-C pressed"} SIGINT
Get Tcl/Tk in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.