[R] "CTRL-C" and "try"

Luke Tierney luke at stat.umn.edu
Thu Apr 11 16:12:53 CEST 2002


The first one is probably not being ignored but is being caught by the
`try'.  This is the way `try' and C-c currently interact--it is not
clear this is the right thing to do or that this will remain true.
One of the things in the works is a more structured exception handling
system that will allow the interaction of try, C-c, and other
non-local exits to be specified more clearly.

I suspect you are using C-c again before R has a chance to get back to
the top level command loop.  I believe solaris is one of those systems
where signal handlers need to be re-installed after a signal is
received.  We currently do this at the top level loop but not at the
point where a `try' intercepts a jump out of a C-c.  As a result the
default signal handler is in place for the period between the first
C-c and return to the top level loop, and the default handler exits
when a C-c is received.  [I'm speculating a bit here since I don't
have easy access to a solaris system, but you should be able to
confirm it by running

{ try(repeat{}); cat("got through try\n"); repeat{}}

at the command line.  The first C-c should take you out of the `try'.
On my Linux system a second C-c takes me to the command line but on
your it probably exits R.]

luke

On Thu, Apr 11, 2002 at 03:17:30PM +0200, lutz.thieme at amd.com wrote:
> Hello everybody,
> 
> if I'm running a R-script on a command line R-session which uses the function "try" and I'd like
> to interrupt the execution of my R-script pressing "CTRL-C" than R ignores the first "CTRL-C"
> key stroke and after I pressed "CTRL-C" second time R by itself is interrupted and I fall back 
> to the (UNIX-) command prompt. Without using "try" all works fine and I'm able to interrupt my
> R-script. How can I avoid this behavior?
> 
> platform sparc-sun-solaris2.8
> arch     sparc               
> os       solaris2.8          
> system   sparc, solaris2.8   
> status                       
> major    1                   
> minor    3.0                 
> year     2001                
> month    06                  
> day      22                  
> language R  
> 
> Thanks in advance - regards,
> 
> Lutz
> 
> Lutz Thieme
> AMD Saxony Manfacturing GmbH
> Product Engineering
> phone:	+49 351 277-4269
> fax:	+49 351 277-9-4269
> email:	lutz.thieme at amd.com
> 
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- 
Luke Tierney
University of Minnesota                      Phone:           612-625-7843
School of Statistics                         Fax:             612-624-8868
313 Ford Hall, 224 Church St. S.E.           email:      luke at stat.umn.edu
Minneapolis, MN 55455 USA                    WWW:  http://www.stat.umn.edu
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list