Parker Jones
2008-Jan-22 11:12 UTC
[R] Communicating with R through a named pipe: display refresh problem
Hello, On a linux system I'm trying to send commands to R through a named pipe and am *nearly* successful. I can send R commands and can plot graphs. The only problem I have is getting the x11 display to refresh - it appears to hang because of the pipe. The R server: $ mkfifo R_pipe $ R --no-save < R_pipe The R client: $ cat>> R_pipe Now, I can send R commands down the pipe: Client side: x <- seq(1,10) x Server side:> x <- seq(1:10) > x[1] 1 2 3 4 5 6 7 8 9 10 This is perfect. Now if I try to create a plot, e.g. plot(1:100), the server shows> plot(1:100)and the plot appears. However, if a window briefly obscures the graphical output, the x11 device won't refresh the display. It would appear the pipe is blocking the refresh. Can anyone else confirm this happens and any suggestions how to get the display to refresh? Thanks in advance, PJ
Prof Brian Ripley
2008-Jan-22 15:08 UTC
[R] Communicating with R through a named pipe: display refresh problem
Rather, non-interactive R does not run an event loop. The usual way around this is to use a pty, as R run from a pty is considered to be interactive. (Whether a fifo and a named pipe are the same concept is moot: some OSes have one and not the other.) The plan is to use threads in due course to handle X11 events. On Tue, 22 Jan 2008, Parker Jones wrote:> > Hello, > > On a linux system I'm trying to send commands to R through a named pipe and am *nearly* successful. I can send R commands and can plot graphs. The only problem I have is getting the x11 display to refresh - it appears to hang because of the pipe. > > The R server: > $ mkfifo R_pipe > $ R --no-save < R_pipe > > The R client: > $ cat>> R_pipe > > Now, I can send R commands down the pipe: > > Client side: > x <- seq(1,10) > x > > Server side: >> x <- seq(1:10) >> x > [1] 1 2 3 4 5 6 7 8 9 10 > > This is perfect. > > Now if I try to create a plot, e.g. plot(1:100), the server shows >> plot(1:100) > and the plot appears. However, if a window briefly obscures the graphical output, the x11 device won't refresh the display. It would appear the pipe is blocking the refresh. > > Can anyone else confirm this happens and any suggestions how to get the display to refresh? > > Thanks in advance, > PJ-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595