From 0c5d10dcbb4a344ce522b3eac2f1d1f20c9647fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Sch=C3=A4del?= <42519751+mcranium@users.noreply.github.com> Date: Sun, 21 Sep 2025 20:58:59 +0200 Subject: [PATCH 1/7] Update CallRev.R fix corrupt temp file path --- R/CallRev.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/CallRev.R b/R/CallRev.R index 2d1b214..f4f5437 100644 --- a/R/CallRev.R +++ b/R/CallRev.R @@ -100,8 +100,8 @@ callRev <- function (..., coerce = FALSE, path = Sys.getenv("rb"), viewCode = FA argu <- c("setwd(\"" %+% wd %+% "\")", argu) } - tf <- tempfile(pattern = "file", tmpdir = paste(Sys.getenv("revTemps"), - "/", sep = ""), fileext = ".rev") + tf <- tempfile(pattern = "file", tmpdir = file.path(Sys.getenv("revTemps")), fileext = ".rev") + tf <- suppressWarnings((gsub(pattern = "\\\\", "/", tf))) From f4fc1b5cb47b28da9b8425c8af26554342d58b83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Sch=C3=A4del?= <42519751+mcranium@users.noreply.github.com> Date: Sun, 21 Sep 2025 22:15:03 +0200 Subject: [PATCH 2/7] Update CallRev.R --- R/CallRev.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/CallRev.R b/R/CallRev.R index f4f5437..dbeb80f 100644 --- a/R/CallRev.R +++ b/R/CallRev.R @@ -109,7 +109,7 @@ callRev <- function (..., coerce = FALSE, path = Sys.getenv("rb"), viewCode = FA ret <- unlist(argu) writeLines(ret, fopen, sep = "\n") out <- system2(path, args = c(tf), stdout = TRUE, timeout=timeout) - out <- out[-c(1:13, length(out) - 1, length(out))] + #out <- out[-c(1:13, length(out) - 1, length(out))] cat("Input:\n --> " %+% ret %+% "\n//", file = tf, sep = "\n", append = FALSE) cat("Output:\n --> " %+% out %+% "\n//", file = tf, From 7a35213bfbf3f811665e16b130a92731bd78e704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Sch=C3=A4del?= <42519751+mcranium@users.noreply.github.com> Date: Sun, 21 Sep 2025 22:23:12 +0200 Subject: [PATCH 3/7] Update CallRev.R --- R/CallRev.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/CallRev.R b/R/CallRev.R index dbeb80f..917c1cf 100644 --- a/R/CallRev.R +++ b/R/CallRev.R @@ -108,8 +108,8 @@ callRev <- function (..., coerce = FALSE, path = Sys.getenv("rb"), viewCode = FA fopen <- file(tf) ret <- unlist(argu) writeLines(ret, fopen, sep = "\n") - out <- system2(path, args = c(tf), stdout = TRUE, timeout=timeout) - #out <- out[-c(1:13, length(out) - 1, length(out))] + out <- system2(path, args = c(tf), stdout = TRUE, stderr = TRUE, timeout=timeout) + out <- out[-c(1:13, length(out) - 1, length(out))] cat("Input:\n --> " %+% ret %+% "\n//", file = tf, sep = "\n", append = FALSE) cat("Output:\n --> " %+% out %+% "\n//", file = tf, From c804afbe38af0f0c86f0aefb3a6e3a3a37407332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Sch=C3=A4del?= <42519751+mcranium@users.noreply.github.com> Date: Sun, 21 Sep 2025 22:33:51 +0200 Subject: [PATCH 4/7] Update CallRev.R --- R/CallRev.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/CallRev.R b/R/CallRev.R index 917c1cf..0605c1d 100644 --- a/R/CallRev.R +++ b/R/CallRev.R @@ -108,8 +108,8 @@ callRev <- function (..., coerce = FALSE, path = Sys.getenv("rb"), viewCode = FA fopen <- file(tf) ret <- unlist(argu) writeLines(ret, fopen, sep = "\n") - out <- system2(path, args = c(tf), stdout = TRUE, stderr = TRUE, timeout=timeout) - out <- out[-c(1:13, length(out) - 1, length(out))] + out <- system2(path, args = c(tf), stdout = TRUE, timeout=timeout) + out <- out[-c(length(out) - 1, length(out))] cat("Input:\n --> " %+% ret %+% "\n//", file = tf, sep = "\n", append = FALSE) cat("Output:\n --> " %+% out %+% "\n//", file = tf, From 4e103499a317cdcda5112233e3d46fe803a06286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Sch=C3=A4del?= <42519751+mcranium@users.noreply.github.com> Date: Sun, 21 Sep 2025 22:37:57 +0200 Subject: [PATCH 5/7] Update CallRev.R --- R/CallRev.R | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/R/CallRev.R b/R/CallRev.R index 0605c1d..f381220 100644 --- a/R/CallRev.R +++ b/R/CallRev.R @@ -109,7 +109,20 @@ callRev <- function (..., coerce = FALSE, path = Sys.getenv("rb"), viewCode = FA ret <- unlist(argu) writeLines(ret, fopen, sep = "\n") out <- system2(path, args = c(tf), stdout = TRUE, timeout=timeout) - out <- out[-c(length(out) - 1, length(out))] + + has_banner <- any(grepl("RevBayes version", out)) + + if (has_banner) { + # build safe drop indices + drop_idx <- c(seq_len(13), length(out) - 1, length(out)) + drop_idx <- drop_idx[drop_idx > 0 & drop_idx <= length(out)] + out <- out[-drop_idx] + } else { + warning("Banner not found; skipping header trim.") + # optionally still drop footer alone: + # if (length(out) > 1) out <- out[-c(length(out) - 1, length(out))] + } + cat("Input:\n --> " %+% ret %+% "\n//", file = tf, sep = "\n", append = FALSE) cat("Output:\n --> " %+% out %+% "\n//", file = tf, From 011d9c3db7c67e52d6504814e66edf804aeae074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Sch=C3=A4del?= <42519751+mcranium@users.noreply.github.com> Date: Sun, 21 Sep 2025 22:40:08 +0200 Subject: [PATCH 6/7] Update CallRev.R --- R/CallRev.R | 6 ------ 1 file changed, 6 deletions(-) diff --git a/R/CallRev.R b/R/CallRev.R index f381220..e57b0d8 100644 --- a/R/CallRev.R +++ b/R/CallRev.R @@ -113,15 +113,9 @@ callRev <- function (..., coerce = FALSE, path = Sys.getenv("rb"), viewCode = FA has_banner <- any(grepl("RevBayes version", out)) if (has_banner) { - # build safe drop indices drop_idx <- c(seq_len(13), length(out) - 1, length(out)) drop_idx <- drop_idx[drop_idx > 0 & drop_idx <= length(out)] out <- out[-drop_idx] - } else { - warning("Banner not found; skipping header trim.") - # optionally still drop footer alone: - # if (length(out) > 1) out <- out[-c(length(out) - 1, length(out))] - } cat("Input:\n --> " %+% ret %+% "\n//", file = tf, sep = "\n", append = FALSE) From 496c7c51be5bdff473aeee7caa7f2514621d7dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Sch=C3=A4del?= <42519751+mcranium@users.noreply.github.com> Date: Sun, 21 Sep 2025 22:42:39 +0200 Subject: [PATCH 7/7] Update CallRev.R --- R/CallRev.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/CallRev.R b/R/CallRev.R index e57b0d8..b497bb5 100644 --- a/R/CallRev.R +++ b/R/CallRev.R @@ -116,6 +116,7 @@ callRev <- function (..., coerce = FALSE, path = Sys.getenv("rb"), viewCode = FA drop_idx <- c(seq_len(13), length(out) - 1, length(out)) drop_idx <- drop_idx[drop_idx > 0 & drop_idx <= length(out)] out <- out[-drop_idx] + } cat("Input:\n --> " %+% ret %+% "\n//", file = tf, sep = "\n", append = FALSE)