Avoid hang when writing to named pipe which disappears and comes back
<p>I have a program which dumps information into a named pipe like this:</p>

<pre><code>cmd=open(destination,'w')
cmd.write(data)
cmd.close()
</code></pre>

<p>This works pretty well until the pipe (destination) disappears while my program is writing to it. The problem is that it keeps hanging on the write part(?)
I was expecting some exception to happen, but that's not the case.
How can I avoid this situation?</p>

<p>Thanks,</p>

<p>Jay</p>
