socat - terminate on STDIN EOF while using fork option
<p>I'm using <strong>socat</strong> to publish data from stdin on a port. In brief:</p>

<pre><code>some_process | socat -u - tcp-listen:8888,reuseaddr,fork
</code></pre>

<p>I want the pipeline to stay alive as readers on port 8888 come and go, hence the <strong>fork</strong> option, but I also want <strong>socat</strong> to terminate if <strong>some_process</strong> dies. Currently it stays alive in that case also.</p>

<p>A simple test case is:</p>

<pre><code>while : ; do echo 1; sleep 1; done | socat -u - tcp-listen:8888,reuseaddr,fork
</code></pre>

<p>which gives this process tree (via pstree):</p>

<pre><code>bash─┬─bash───sleep
     └─socat
</code></pre>

<p>If I kill the second bash (which is running the while loop) then I get:</p>

<pre><code>bash───socat
</code></pre>

<p>I want <strong>socat</strong> to have terminated also. Is what I want possible?</p>