Skip to content

Error: ignoring SIGPIPE signal

2 messages · Farid Cheraghi, Rasmus Liland

#
Hi,

```R
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
#
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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20210316/26ae8a26/attachment.sig>