diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2016-02-04 18:06:15 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2016-02-04 18:06:15 +0100 |
commit | d14923ae1ac023c8f8f5ae8b5c0884f4247f764b (patch) | |
tree | 98cbafd22f11944e26fc39126096d59c64adc2d0 /pkg/R | |
parent | 98a706373107188496a1df295697e739e51d6b06 (diff) |
Test reading .out files and close connections
Diffstat (limited to 'pkg/R')
-rw-r--r-- | pkg/R/TOXSWA_cwa.R | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/pkg/R/TOXSWA_cwa.R b/pkg/R/TOXSWA_cwa.R index a693dc1..d2720a9 100644 --- a/pkg/R/TOXSWA_cwa.R +++ b/pkg/R/TOXSWA_cwa.R @@ -187,6 +187,7 @@ TOXSWA_cwa <- R6Class("TOXSWA_cwa", "integer", rep("numeric", 5)), col.names = c("datetime", "t", "segment", "xcd", "cwa_tot", "cwa", "Xss", "Xmp"))) + if (is.null(zipfile)) close(file_connection) # only needed for files if (!inherits(cwa_all_segments, "try-error")) { @@ -219,9 +220,7 @@ TOXSWA_cwa <- R6Class("TOXSWA_cwa", # out file from FOCUS TOXSWA 4 (TOXSWA 4.4.2 or similar) outfile <- try(readLines(file_connection)) - if (is.null(zipfile)) { - close(file_connection) # only needed for files - } + close(file_connection) # only needed for files if (inherits(outfile, "try-error")) { stop("Could not read ", filename) |