Skip to content

Add checks for NA in return status #544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* Fixed bug that caused stdour/stderr not being read at the end of
optimization. (#522)

* Fixed issue with handling `NA` as the reported external process
status. (#544, @myshkin)

### New features

* Default directory changed to `.cmdstan` instead of `.cmdstanr` so that
Expand Down
4 changes: 2 additions & 2 deletions R/model.R
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ compile <- function(quiet = TRUE,
},
error_on_status = FALSE
)
if (run_log$status != 0) {
if (is.na(run_log$status) || run_log$status != 0) {
stop("An error occured during compilation! See the message above for more information.",
call. = FALSE)
}
Expand Down Expand Up @@ -676,7 +676,7 @@ check_syntax <- function(pedantic = FALSE,
},
error_on_status = FALSE
)
if (run_log$status != 0) {
if (is.na(run_log$status) || run_log$status != 0) {
stop("Syntax error found! See the message above for more information.",
call. = FALSE)
}
Expand Down
2 changes: 1 addition & 1 deletion R/run.R
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ CmdStanRun$set("private", name = "run_variational_", value = .run_other)
stdout = stdout_file,
error_on_status = FALSE
)
if (ret$status != 0) {
if (is.na(ret$status) || ret$status != 0) {
if (file.exists(stdout_file)) {
cat(readLines(stdout_file), sep = "\n")
}
Expand Down