Skip to content
Prev 54445 / 63424 Next

cannot destroy connection (?) created by readLines in a tryCatch

Gabor,

You can grab the connection and destroy it via getConnection and then a
standard close call. (it actually lists that it is "closed" already, but
still in the set of existing connections. I can't speak to that difference).
+   readLines(tempfile(), warn = FALSE)[1],

+   error = function(e) NA,

+   warning = function(w) NA

+ )

[1] NA
used (Mb) gc trigger (Mb) max used (Mb)

Ncells 257895 13.8     592000 31.7   416371 22.3

Vcells 536411  4.1    8388608 64.0  1795667 13.7
description


0 "stdin"


1 "stdout"


2 "stderr"


3
"/var/folders/79/l_n_5qr152d2d9d9xs0591lh0000gn/T//RtmpZRcxmh/file128a13bffc77"

  class      mode text   isopen   can read can write

0 "terminal" "r"  "text" "opened" "yes"    "no"

1 "terminal" "w"  "text" "opened" "no"     "yes"

2 "terminal" "w"  "text" "opened" "no"     "yes"

3 "file"     "r"  "text" "closed" "yes"    "yes"
A connection with


description
"/var/folders/79/l_n_5qr152d2d9d9xs0591lh0000gn/T//RtmpZRcxmh/file128a13bffc77"

class       "file"


mode        "r"


text        "text"


opened      "closed"


can read    "yes"


can write   "yes"
description class      mode text   isopen   can read can write

0 "stdin"     "terminal" "r"  "text" "opened" "yes"    "no"

1 "stdout"    "terminal" "w"  "text" "opened" "no"     "yes"

2 "stderr"    "terminal" "w"  "text" "opened" "no"     "yes"


HTH,
~G

On Thu, Dec 14, 2017 at 10:02 AM, G?bor Cs?rdi <csardi.gabor at gmail.com>
wrote: