Question: I am piping the output of a program like this using bash:

```
program1 | program2

```

If program2 is killed somehow (in my case by a PHP fatal error), what happens to the instance of program1?

Answer: 
The pipe will be broken and the program writing to the pipe will receive a SIGPIPE signal.

From [GLIBC](http://www.delorie.com/gnu/docs/glibc/libc_477.html):

> 
> SIGPIPE
>  Broken pipe. If you use pipes or FIFOs, you have to design your
>  application so that one process opens
>  the pipe for reading before another
>  starts writing. If the reading process
>  never starts, ***or terminates
>  unexpectedly***, writing to the pipe or
>  FIFO raises a SIGPIPE signal. If
>  SIGPIPE is blocked, handled or
>  ignored, the offending call fails with
>  EPIPE instead.
> 
> 
>
Nothing. Data goes to /dev/null. 
P.S. Oh, yes, the program will recieve a signal, but it doesn't mean it will have to close.