Error: ignoring SIGPIPE signal

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error: ignoring SIGPIPE signal

Farid Cheraghi
Hi,

```R
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux bullseye/sid

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.13.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C
               LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base

other attached packages:
[1] colorout_1.2-2

loaded via a namespace (and not attached):
[1] compiler_4.0.3
```

What is wrong with the following Shell script that gives the error? If
you decrease the sequencing number from 50 to e.g. 10 the error might
disappear!

```bash
seq 50 | Rscript -e "cat(readLines(file('stdin')), sep='\n')" | head -n 2
1
2
Error in cat(readLines(file("stdin")), sep = "\n") :
  ignoring SIGPIPE signal
Execution halted
```

It is already asked on StackOverflow without a good answer:
https://stackoverflow.com/questions/28915838/piping-rscript-gives-error-after-output

thanks,
Farid

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Error: ignoring SIGPIPE signal

Rasmus Liland-3
Hello there,

This error happens if you did not finish
reading from the pipe.  

E.g. I have this function in my local
zshrc, to read tsv files with less in
terminal width ...

        readdelim() { Rscript -e "options(width=$COLUMNS); read.delim('$1', check.names=FALSE, na='N/A')" | less }

... and if the tsv file has many lines I
did not scroll completely to the bottom
(read all of the pipe into less), I also
get that error from the R end of the
pipe.

R

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

signature.asc (849 bytes) Download Attachment