@@ -100,16 +100,24 @@ callRev <- function (..., coerce = FALSE, path = Sys.getenv("rb"), viewCode = FA
100100 argu <- c(" setwd(\" " %+ % wd %+ % " \" )" , argu )
101101 }
102102
103- tf <- tempfile(pattern = " file" , tmpdir = paste (Sys.getenv(" revTemps" ),
104- " / " , sep = " " ), fileext = " .rev " )
103+ tf <- tempfile(pattern = " file" , tmpdir = file.path (Sys.getenv(" revTemps" )), fileext = " .rev " )
104+
105105
106106 tf <- suppressWarnings((gsub(pattern = " \\\\ " , " /" , tf )))
107107
108108 fopen <- file(tf )
109109 ret <- unlist(argu )
110110 writeLines(ret , fopen , sep = " \n " )
111- out <- system2(path , args = c(tf ), stdout = TRUE , timeout = timeout )
112- out <- out [- c(1 : 13 , length(out ) - 1 , length(out ))]
111+ out <- system2(path , args = c(tf ), stdout = " " , timeout = timeout )
112+
113+ has_banner <- any(grepl(" RevBayes version" , out ))
114+
115+ if (has_banner ) {
116+ drop_idx <- c(seq_len(13 ), length(out ) - 1 , length(out ))
117+ drop_idx <- drop_idx [drop_idx > 0 & drop_idx < = length(out )]
118+ out <- out [- drop_idx ]
119+ }
120+
113121 cat(" Input:\n --> " %+ % ret %+ % " \n //" , file = tf ,
114122 sep = " \n " , append = FALSE )
115123 cat(" Output:\n --> " %+ % out %+ % " \n //" , file = tf ,
0 commit comments