title: subprocess.Popen("ssh host@remote cmd") failed
body: <p>I'm new to python subprocess. When I want to use python subprocess.Popen.communicate to accomplish interact passwd with shell cmd "net ads join -U administrator", it's output didn't redirect into PIPE, but in stdout.My code is under:</p>
  
  <pre><code>import subprocess
  
  import os
  import sys
  
  passwd = b'123456'
  cmd = "net ads join -U administrator"
  s1 = ("%s\n" % str(passwd)).encode('utf-8')
  p1 = subprocess.Popen(cmd1,shell=True,stdin=subprocess.PIPE,stdout=subprocess.PIPE,
                                       stderr=subprocess.PIPE,close_fds=True)
  out,err = p1.communicate(s1)
  print(out)
  </code></pre>
  
  <p>When I run the test, communicate didn't work, the output still in the stdout.</p>
  
  <pre><code>$ python ads.py 
  Enter administrator's password:
  </code></pre>
  
  <p>When I change the cmd to "ssh root@ip ls /", I also met with the problem.</p>
  
  <p>I tried pdb, but the problem seems not here.
  Any advise to deal with this problem? Thank You</p>