Dear R-devel, I'm curious why writeBin should always return NULL. Would anyone's code break if we made it return the number of bytes written? I'm not sure how else I'm supposed to use writeBin on a writable connection in non-blocking mode...
See attached. Thank you, Frederick
>From 3304e714f204c22d8e5c2ae93828683e04d1569d Mon Sep 17 00:00:00 2001 From: frede...@ofb.net Date: Fri, 22 May 2020 15:42:37 -0700 Subject: [PATCH 1/1] Return number of bytes written --- src/main/connections.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/connections.c b/src/main/connections.c index 88f082c696..2c47589018 100644 --- a/src/main/connections.c +++ b/src/main/connections.c @@ -4632,6 +4632,7 @@ SEXP attribute_hidden do_writebin(SEXP call, SEXP op, SEXP args, SEXP env) } else { size_t nwrite = con->write(buf, size, len, con); if(nwrite < len) warning(_("problem writing to connection")); + ans = ScalarInteger(nwrite); } Free(buf); } -- 2.26.2
______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel