Skip to content

Commit fe498ad

Browse files
committed
switch to system2 to be able to capture stderr on error
1 parent ba4e974 commit fe498ad

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

R/Attributes.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ sourceCpp <- function(file = "",
137137

138138
# prepare the command (output if we are in showOutput mode)
139139
args <- c(
140-
r, "CMD", "SHLIB",
140+
"CMD", "SHLIB",
141141
if (windowsDebugDLL) "-d",
142142
if (rebuild) "--preclean",
143143
if (dryRun) "--dry-run",
@@ -147,13 +147,13 @@ sourceCpp <- function(file = "",
147147
shQuote(src)
148148
)
149149

150-
cmd <- paste(args, collapse = " ")
151150
if (showOutput)
152-
cat(cmd, "\n") # #nocov
151+
cat(paste(c(r, args), collapse = " "), "\n") # #nocov
153152

154153
# execute the build -- suppressWarnings b/c when showOutput = FALSE
155154
# we are going to explicitly check for an error and print the output
156-
result <- suppressWarnings(system(cmd, intern = !showOutput))
155+
so <- if (showOutput) "" else TRUE
156+
result <- suppressWarnings(system2(r, args, stdout = so, stderr = so))
157157

158158
# check build results
159159
if(!showOutput) {

0 commit comments

Comments
 (0)