title: Python SSH not giving full output
body: <p>I am trying to write a script that logs onto a remote machine, runs a command and returns the output. I'm doing this in python, using the paramiko library. However, for some reason the full output isn't being produced, only a single line of it.</p>
  
  <p>In an attempt to isolate the problem, I created a local script, called simple, which runs the command and sends the output to a file, remote_test_output.txt. Then I simply sftp the file over instead. The file only contained the same one line. The only line of output is the same every time: the response code of the command.</p>
  
  <p>When I do this all manually (ssh over, log in, and run ./simple), it all works as intended and the output file is correct. However, doing it through the script on my machine, it only returns the single line.</p>
  
  <p>my code:</p>
  
  <pre><code>ssh = paramiko.SSHClient()
  ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  ssh.load_host_keys(os.path.expanduser(os.path.join("~", ".ssh", "known_hosts")))
  ssh.connect(host, username, password)
  
  ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command('LD_LIBRARY_PATH=/opt/bin ./simple\n')
  
  print "output:", ssh_stdout.read()+"end" #Reading output of the executed command
  print "err:", ssh_stderr.read()#Reading the error stream of the executed command
  
  
  sftp = ssh.open_sftp()
  sftp.get('remote_test_output.txt', 'local_test_output.txt')
  sftp.close()
  </code></pre>
  
  <p>What is returned:</p>
  
  <pre><code>response code: 128
  </code></pre>
  
  <p>What should be returned:</p>
  
  <pre><code>field1:value1
  field2:value2
  response code: 128
  field3:value3
  field4:value4
  etc
  </code></pre>
  
  <p>Does anyone have any ideas why the command I'm trying to call isn't outputting normally?</p>
  
  <p>I have to include the LD_LIBRARY_PATH variable assignment or I get a library does not exist error.</p>