title: How to diff file and output stream "on-the-fly"?
body: <p>I need to create a diff file using standard UNIX <strong>diff</strong> command with python <strong>subprocess</strong> module. The problem is that I must compare file and stream without creating tempopary file. I thought about using named pipes via <strong>os.mkfifo</strong> method, but didn't reach any good result. Please, can you write a simple example on how to solve this stuff? I tried like so:</p>
  
  <pre><code>fifo = 'pipe'
  os.mkfifo(fifo)
  op = popen('cat ', fifo)
  print &gt;&gt; open(fifo, 'w'), output
  os.unlink(fifo)
  proc = Popen(['diff', '-u', dumpfile], stdin=op, stdout=PIPE)
  </code></pre>
  
  <p>but it seems like <code>diff</code> doesn't see the second argument.</p>