Christophe Weblog Wiki Code Publications Music
alternative printing for the REPL
[swankr.git] / swank.R
diff --git a/swank.R b/swank.R
index 1dc95b48800c305489292bc95f4cdb92f381e16e..0a309ef7da9b22576d945c26984874f6aa58ef88 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)
@@ -246,7 +247,11 @@ writeSexpToString <- function(obj) {
 
 printToString <- function(val) {
   f <- fifo("")
-  tryCatch({ sink(f); print(val); sink(); readLines(f) },
+  sink(f)
+  tryCatch({
+    tryCatch(str(val, indent.str="", list.len=5, max.level=2),
+             finally=sink())
+    readLines(f) },
            finally=close(f))
 }