Nick Craig-Wood wrote: > Robin Becker <[EMAIL PROTECTED]> wrote: >> I'm using subprocess to carry out svn commands (probably should use the svn >> api ............. >> >> Clearly I need to supply some kind of input filelike object, but is this >> sort of >> thing possible. > > Yes it is possible, but if you try it you'll find you'll need to > implement the fileno() method of file objects which is asked to return > an OS file handle. This is obviously a problem! >
yes I figured I might have to do something low level, but it's not terribly obvious that I can detect the read at the other end ie normally we seem to detect when output is available, not when a write is required ie I might be able to write to the input of my command even if the command won't read. > In general subprocess isn't really designed for interactive > processes like the above. You'll find it much easier to use pexpect > for interactive stuff. > > Note that svn has its own devious ways of finding a terminal to ask > the user for the password, eg... > > $ svn ls svn+ssh://[EMAIL PROTECTED]/svn </dev/null >/dev/null 2>&1 > Password: > > I don't know exactly how it does that but I suspect it is to do with > the controlling terminal... > > On my system > > $ setsid svn ls svn+ssh://[EMAIL PROTECTED]/svn </dev/null >/dev/null 2>&1 > > Pops up a gui box asking for the password! > > You can simulate the above with > > Popen(..., stdin=file(os.devnull,"r"), preexec_fn=os.setsid) ..... this just makes life more interesting :) -- Robin Becker -- http://mail.python.org/mailman/listinfo/python-list