From: Kevin B. <kb...@ca...> - 2002-01-24 16:35:02
|
One additional caveat: 5- close() doesn't give return process return code correctly - it should be something like: return self.process.exitValue() or None kb Kevin Butler wrote: > import java > import org > def popen(path, mode='r'): > r = java.lang.Runtime.getRuntime() > p = r.exec(path) > return org.python.core.PyFile( > p.getInputStream(), > p.getOutputStream(), > mode > ) > Note the following caveats: > > 1- PyFile is an internal class. It may change! Don't rely on it in code you expect to keep working later. > > 2- To get stderr, we'd need to do some wrapping of the stdout & stderr streams into one. > > 3- I don't think the mode handling is quite right. :-) > > 4- Shell built-ins don't work, because we're not invoking a shell |