Skip to content

Commit eaa0e36

Browse files
committed
Use only one file to gather the output from startup to ensure also stdout is displayed if there is something wrong
1 parent 4ad9a43 commit eaa0e36

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

R/connecting.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ runJuliaServer <- function(port = 11980, multiclient = TRUE) {
156156
portfilename <- tempfile(paste0("juliaPort", Sys.getpid()))
157157

158158
# workaround for https://github.com/rstudio/rstudio/issues/2446
159-
stdoutfile <- tempfile('stdout'); stderrfile <- tempfile('stderr')
160-
on.exit(unlink(c(stdoutfile, stderrfile)), add = TRUE)
159+
startupOutputFile <- tempfile('startupOutput');
160+
on.exit(unlink(startupOutputFile), add = TRUE)
161161

162162

163163
if (multiclient == TRUE) {
@@ -178,7 +178,7 @@ runJuliaServer <- function(port = 11980, multiclient = TRUE) {
178178
args = c(startupOpts, shQuote(mainJuliaFile), port, shQuote(portfilename),
179179
multiclient),
180180
wait = FALSE,
181-
stdout = stdoutfile, stderr = stderrfile,
181+
stdout = startupOutputFile, stderr = startupOutputFile,
182182
env = getJuliaEnv())
183183

184184
# get information about the real port from the temporary file
@@ -188,8 +188,8 @@ runJuliaServer <- function(port = 11980, multiclient = TRUE) {
188188
Sys.sleep(sleepTime)
189189
timeSlept <- timeSlept + sleepTime
190190
if (timeSlept >= 50) {
191-
try({cat(paste(readLines(stderrfile), collapse = "\n"),
192-
file = stderr())})
191+
try({cat(paste(readLines(startupOutputFile), collapse = "\n"),
192+
file = stdout())})
193193
stop("Timeout while waiting for response from Julia server")
194194
}
195195
}

0 commit comments

Comments
 (0)