Christophe Weblog Wiki Code Publications Music
integrate into R's event loop, possibly
authorChristophe Rhodes <csr21@cantab.net>
Fri, 3 Sep 2010 07:07:43 +0000 (08:07 +0100)
committerChristophe Rhodes <csr21@cantab.net>
Fri, 3 Sep 2010 07:07:43 +0000 (08:07 +0100)
in readPacket, call socketSelect() before actually trying to read on
the connection.  This seems to allow R to update graphics windows and
other such niceties.

It would be nice to be able to preserve the (inferior) R REPL as well,
but I haven't yet discovered whether that's possible.

swank.R

diff --git a/swank.R b/swank.R
index 1dc95b4..99f508b 100644 (file)
--- a/swank.R
+++ b/swank.R
@@ -113,6 +113,7 @@ sldbLoop <- function(slimeConnection, sldbState, id) {
 }
 
 readPacket <- function(io) {
+  socketSelect(list(io))
   header <- readChunk(io, 6)
   len <- strtoi(header, base=16)
   payload <- readChunk(io, len)