Re: [Rd] Rscript -e EXPR fails to launch if stdin is closed

2022-10-14 Thread peter dalgaard
Done... -pd > On 11 Oct 2022, at 10:53 , peter dalgaard wrote: > > There's still 2 weeks till code freeze for 4.2.2, and porting the fix would > be trivial. As long as there is no risk that someone will get the bright idea > of changing a critical package to depend on R >= 4.2.2... > > - pd

Re: [Rd] Rscript -e EXPR fails to launch if stdin is closed

2022-10-13 Thread Dirk Eddelbuettel
On 10 October 2022 at 09:34, Henrik Bengtsson wrote: | Thank you Peter for the quick fix. Will this make it into R-patched | to become R 4.2.2 soon? I checked when you posted this and didn't reply -- but this is also not an issue for littler so if you need alternative there is one $ Rscript

Re: [Rd] Rscript -e EXPR fails to launch if stdin is closed

2022-10-11 Thread peter dalgaard
There's still 2 weeks till code freeze for 4.2.2, and porting the fix would be trivial. As long as there is no risk that someone will get the bright idea of changing a critical package to depend on R >= 4.2.2... - pd > On 10 Oct 2022, at 18:34 , Henrik Bengtsson > wrote: > > Thank you Peter

Re: [Rd] Rscript -e EXPR fails to launch if stdin is closed

2022-10-10 Thread Henrik Bengtsson
Thank you Peter for the quick fix. Will this make it into R-patched to become R 4.2.2 soon? I can confirm that the fix resolved also the original problem report involving launching a parallel PSOCK cluster from within a 'processx' background process

Re: [Rd] Rscript -e EXPR fails to launch if stdin is closed

2022-10-10 Thread peter dalgaard
It seems to work simply to do "if (ifd >= 0)..." (the ifp test is fine since ifp is FILE* and initialized to NULL). Will commit (to r-devel for now). -pd > On 10 Oct 2022, at 11:07 , peter dalgaard wrote: > > He! > > Yes, that looks like a blunder. > > mkstemp() returns -1 on failure, not

Re: [Rd] Rscript -e EXPR fails to launch if stdin is closed

2022-10-10 Thread peter dalgaard
He! Yes, that looks like a blunder. mkstemp() returns -1 on failure, not 0, so the test on ifd (and I suppose also the one on ifp) is wrong. And of course, once you close file descriptor 0, mkstemp() chooses the 1st available fd, i.e. 0, for its return value. -pd > On 9 Oct 2022, at 20:25 ,

[Rd] Rscript -e EXPR fails to launch if stdin is closed

2022-10-09 Thread Henrik Bengtsson
Rscript fails to launch if the standard input (stdin) is closed, e.g. $ Rscript --vanilla -e 42 0<&- Fatal error: creating temporary file for '-e' failed This appear to only happen with `-e EXPR`, e.g. it works when doing: $ echo "42" > script.R $ Rscript --vanilla script.R 0<&- [1] 42 and: $