Environment > Miscellaneous Environment Topics > Interrupting or Aborting Execution

# Interrupting or Aborting Execution

To manually stop programs that are running, issue a keyboard interrupt by typing Ctrl+C.

Note: If you are using the IDL Workbench, Ctrl+C interrupts execution only when the focus is in the IDL command line and a program is running. In other situations, Ctrl+C copies the current selection to the clipboard.

A message indicating the statement number and program unit being executed is issued on the terminal or IDL Console acknowledging the interrupt. The values of variables can be examined, statements can be entered from the keyboard, and variables can be changed. The program can be resumed by issuing the .CONTINUE executive command to resume or the .STEP executive command to execute the next statement and stop.

## Variable Context After Interruption

When a program is interrupted, the variable context is within the program unit where the program stopped. IDL checks for interrupts after each statement. Program execution does not stop until the active statement finishes, so it can take some time after you type an interrupt for the program to be interrupted.

Note: You can view the variables in a program using the IDL Workbench Variables view.

To revert to the next-higher program level, use the RETURN statement at the Command Line. You can repeat this command until the program returns to the main level. To return control to the main program level, use the RETALL command. To find out where the interrupt occurred, use the HELP command to determine the program context.

## Aborting IDL on UNIX Systems

If you use IDL in command-line mode on a UNIX system and need to abort rather than exit using the EXIT command, type Ctrl+\. This is a very abrupt exit—all variables are lost, and open files may not be saved. You should always close IDL using the EXIT command when possible. Avoid using Ctrl+\ except in emergency situations.

Note: After aborting IDL by using Ctrl+\, you may find that your terminal is left in the wrong state. You can restore your terminal to the correct state by issuing one of the following UNIX commands:
`% reset` or `% stty echo -cbreak`