Skip to content

Commit bc1d9af

Browse files
small format change
Co-authored-by: Steve Bronder <Stevo15025@gmail.com>
1 parent 4c8fbd8 commit bc1d9af

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

R/model.R

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,9 @@ CmdStanModel <- R6::R6Class(
297297

298298
# exe_info is updated inside the compile method (if compile command is run)
299299
self$exe_info(update = TRUE)
300-
if(file.exists(self$exe_file())) exe_info_reflects_cpp_options(self$exe_info(), args$cpp_options)
300+
if(file.exists(self$exe_file())) {
301+
exe_info_reflects_cpp_options(self$exe_info(), args$cpp_options)
302+
}
301303
}
302304
if (length(self$exe_file()) > 0 && file.exists(self$exe_file())) {
303305
private$cpp_options_ <- model_compile_info_legacy(self$exe_file(), self$cmdstan_version())
@@ -368,7 +370,10 @@ CmdStanModel <- R6::R6Class(
368370
info <- if (cli_info_success) parse_exe_info_string(ret$stdout) else list()
369371
cpp_options <- exe_info_style_cpp_options(private$precompile_cpp_options_)
370372
compiled_with_cpp_options <- !is.null(private$cmdstan_version_)
371-
373+
if(!cli_info_success) warning(
374+
'Retrieving exe_file info failed. ',
375+
'This may be due to running a model that was compiled with pre-2.26.1 cmdstan.'
376+
)
372377
private$exe_info_ <- if (compiled_with_cpp_options) {
373378
# recompile has occurred since the CmdStanModel was created
374379
# cpp_options as were used as configured
@@ -402,7 +407,9 @@ CmdStanModel <- R6::R6Class(
402407
# this is intentionally not private$cmdstan_version_
403408
# because that value is only set if model has been recomplied
404409
# since CmdStanModel instantiation
405-
if (!fallback) self$exe_info()[['stan_version']]
410+
if (!fallback) {
411+
return(self$exe_info()[['stan_version']])
412+
}
406413
for (candidate in c(
407414
self$exe_info()[['stan_version']],
408415
self$exe_info_fallback()[['stan_version']]

0 commit comments

Comments
 (0)