title: python subprocess communicate freezes
body: <p>I have the following python code that hangs :</p>
  
  <pre><code>cmd = ["ssh", "-tt", "-vvv"] + self.common_args
  cmd += [self.host]
  cmd += ["cat &gt; %s" % (out_path)]
  p = subprocess.Popen(cmd, stdin=subprocess.PIPE,
                           stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  stdout, stderr = p.communicate(in_string)
  </code></pre>
  
  <p>It is supposed to save a string (in_string) into a remote file over ssh.</p>
  
  <p>The file is correctly saved but then the process hangs. If I use</p>
  
  <pre><code>cmd += ["echo"] instead of
  cmd += ["cat &gt; %s" % (out_path)]
  </code></pre>
  
  <p>the process does not hang so I am pretty sure that I misunderstand something about the way communicate considers that the process has exited.</p>
  
  <p>do you know how I should write the command so the the "cat > file" does not make communicate hang ?</p>