jed-users mailing list

[2005 Date Index] [2005 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: infinite loop when using read_mini


Marvin Lyndon <marvin.lyndon@xxxxxxxxxxx> wrote:
>I just returned to the code that prompted this question and I don't seem to 
>be getting this behavior. Ie, pressing ^G is generating an  UserBreakError 
>exception rather than causing read_mini() to merely return an empty string.

Sorry about the misleading and incorrect information.  Pressing ^G
while in read_mini will result in a UserBreakError exception being
thrown.  The exception to this is during startup, where for security
reasons, the UserBreakError is not thrown.  This is why you see
the different behaviors depending upon when your test function is
executed.  

Whether or not a keyboard interrupt generates a UserBreakError
exception is controlled by the value of the IGNORE_USER_ABORT
variable.  As a result, you might try something like:

define test()
{
   variable input;

   do
     {
	IGNORE_USER_ABORT++;
        try 
	  {
	     input = read_mini("type something","","");
	  }
        finally IGNORE_USER_ABORT--;
     }
   while (strlen(input) == 0);

   return input;
}

Thanks,
--John

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2005 date index] [2005 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]