Disconnects and Program Terminations

In some cases, having a process terminate due to an unexpected Telnet disconnect can be very inconvenient, and you would prefer that the process continue to run anyway. As of A-Shell/UNIX 4.7, this is automatic, provided that the process does not require any keyboard input (which is not practical with a process that has lost its terminal connection.) When the hangup signal is detected, the A-Shell will convert the session into an independent background session and keep running. The process will continue running until it gets another error or until it stops to wait for keyboard input. At that point, it will get an error 250 (as described above), allowing the program to perform any desired cleanup/shutdown procedures. When the program then goes back into another keyboard wait (i.e. returns to a menu, or drops to the dot prompt, or prompts within the error trap for some kind of user response), then it will be terminated and forcefully shut down.

The –hetcki switch causes a TCKI (check for keyboard without waiting) operation to be treated like a regular keyboard request, which will then cause a disconnected session to be terminated. This is useful in programs like ASTAT, which might otherwise run forever after being disconnected. ASTAT in fact internally sets this flag using MX_CLFLAGS while it is running, and then restores the flags that were originally set as it exits.

The –hei switch is needed to get the old hangup behavior, which was to immediately generate a BASIC error 250 and then wait for the program to shut down or to go into a keyboard wait. You might want to set this switch in a program that you specifically did not want to continue running if the session was terminated (possibly a large report that was intended to be output to the screen or workstation printer).