This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: popen4/cygwin ssh hangs
Type: Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: jlt63 Nosy List: jlt63, nnorwitz, ph_e
Priority: normal Keywords:

Created on 2005-01-13 16:21 by ph_e, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg23956 - (view) Author: Ph.E (ph_e) Date: 2005-01-13 16:21
The following python code hangs on executing cmd2
(works with cmd1).
The commands works fine when executed on a shell.
I have the same problem with Python 2.3.4 and 2.4
(Windows).
I use the latest Cygwin binaries 


import os

cmd1 = "bin\\ssh"
cmd2 = "bin\\ssh -i id_dsa admin@myserver.com uptime"

def docmd(cmd):
    print "Doing %s ..." % cmd
    
    (stdin, stdouterr) = os.popen4(cmd)
    
    for line in stdouterr.readlines():
        print line
    
    stdin.close()
    stdouterr.close()
    print "Done."

if __name__ == '__main__':
    docmd(cmd1)
    docmd(cmd2)

Give me some advice for testing (popen, linux, ...).
msg23957 - (view) Author: Ph.E (ph_e) Date: 2005-01-13 17:33
Logged In: YES 
user_id=1196530

The same code in Linux Python 2.3.4 works fine.
msg23958 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2005-09-30 05:36
Logged In: YES 
user_id=33168

Jason?
msg23959 - (view) Author: Jason Tishler (jlt63) * (Python triager) Date: 2005-10-03 12:36
Logged In: YES 
user_id=86216

AFAICT, this works for me under Cygwin 1.5.18 and Python
2.4.1:

$ python /tmp/sf.py
Doing ssh ...
usage: ssh [-1246AaCfgkMNnqsTtVvXxY] [-b bind_address] [-
c cipher_spec]

           [-D port] [-e escape_char] [-F configfile]

           [-i identity_file] [-L [bind_address:]port:host:hostport]

           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o 
option] [-p port]

           [-R [bind_address:]port:host:hostport] [-S ctl_path]

           [user@]hostname [command]

Done.
Doing ssh -i id_rsa server uptime ...
  8:29am  up 1 day(s),  1:53,  5 users,  load average: 0.41, 
0.52, 0.59

Done.

Note I changed cmd1 and cmd2 also follows:

cmd1 = "ssh"
cmd2 = "ssh -i id_rsa server uptime"

I'm closing this bug report. Please reopen if this is still
a problem.
History
Date User Action Args
2022-04-11 14:56:09adminsetgithub: 41438
2005-01-13 16:21:16ph_ecreate