Dear All, Within a large script, I try to invoke a second program (called e.g. XXX) from R using "shell" or "pipe". e.g.:> readLines(pipe("XXX"))or:> shell("XXX",intern=TRUE, wait = TRUE)After running the program, the script reads a file with solutions produced by the second program ("XXX.001").> readLines("XXX.001")This works fine, when the second program finishes quickly. However, when it takes some more time (like 2 minutes) R does not wait and starts looking for XXX.001 which is not there (yet). Consequently,my beautiful script crashes..... Is there a way to let R wait until the second program really finishes?? the argument "wait = TRUE" obviously doesn't work... thanks uin advance, Robbert -- View this message in context: http://n4.nabble.com/Pipe-shell-R-does-not-wait-tp1458692p1458692.html Sent from the R help mailing list archive at Nabble.com.
robbert blonk wrote:> Dear All, > > Within a large script, I try to invoke a second program (called e.g. XXX) > from R using "shell" or "pipe". > > e.g.: > >> readLines(pipe("XXX")) >> > or: > >> shell("XXX",intern=TRUE, wait = TRUE) >> > > After running the program, the script reads a file with solutions produced > by the second program ("XXX.001"). > > >> readLines("XXX.001") >> > > This works fine, when the second program finishes quickly. However, when it > takes some more time (like 2 minutes) R does not wait and starts looking for > XXX.001 which is not there (yet). Consequently,my beautiful script > crashes..... > > Is there a way to let R wait until the second program really finishes?? the > argument "wait = TRUE" obviously doesn't work...You need to give some details, like R version, platform, etc. If you're on Windows, you might want to try a recent R-devel build: I've recently made some improvements to the system/shell/pipe code. Duncan Murdoch
Sorry, forgot to included the information. Working in Windows (although a try on linux gave the same problems) R 2.10.0 Do you suggest to update a newer version of R? regards, Robbert -- View this message in context: http://n4.nabble.com/Pipe-shell-R-does-not-wait-tp1458692p1458727.html Sent from the R help mailing list archive at Nabble.com.