Penguin

Differences between current version and predecessor to the previous major change of SIGPIPE.

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

Newer page: version 7 Last edited on Wednesday, June 10, 2009 10:00:08 pm by JohnMcPherson
Older page: version 5 Last edited on Monday, October 11, 2004 11:03:30 am by JohnMcPherson Revert
@@ -6,14 +6,15 @@
  $ cat somefile | head 
 After "head" has printed out the first 10 lines and quits, "cat" will get a pipe error. However, cat catches the signal and quits gracefully. If you pipe the output of some cvs(1) commands into less(1) and quit, then you might see the shell print out a message as cvs doesn't handle this signal gracefully. 
  
 Another example, using strace(1) to show system calls: 
+<verbatim>  
  $ strace ls /etc | echo 
  execve("/bin/ls", [["ls", "/etc"], [[/* 52 vars */]) = 0 
  ... 
  write(1, "a2ps\nadjtime\napache2\napm\nasound."..., 1593) = -1 [EPIPE] (Broken pipe) 
  --- SIGPIPE (Broken pipe) @ 0 (0) --- 
  +++ killed by SIGPIPE +++ 
 
+</verbatim>  
  
-  
- If you get this message when writing to a socket, it can be avoided by passing [MSG_NOSIGNAL] as a flag to send().  
+If you get this message when writing to a socket, it can be avoided by passing [MSG_NOSIGNAL] as a flag to send() or ignoring the signal by using signal(SIGPIPE,SIG_IGN);