c - How disable buffering output of process, which was started in Python by use execl? -


i'm new person in world of python , i've problem buffering (but think not python problem). want write own debugger under linux. need redirect stdin, stdout , stderr different descriptor, because want show output in debugger console.

so code is:

mylib = cdll("libc.so.6") self.pid = os.fork()  if (self.pid == 0):         c = os.open("myfile", 1, 0)         os.dup2(c,0)                    os.dup2(c,1)         os.dup2(c,2)         mylib.ptrace(ptracerequest.ptrace_traceme, 0, 0, 0)          os.execl("fib.out", "fib")         sys.exit()     else:         print(self.pid) 

the problem in execl. don't know why, streams buffered (or think buffering source of problem :) ). testing program fib.out (it display first 5 value of fibonacci sequence 5 sec break between values) visible after fib.out finished.

i changed third argument in os.open - documentations says 0 third argument means no buffering, don't work me. when output redirected on /dev/pts/12 - works fine. looks me problem can connected default value of streams buffer.

in c have 'setvbuf', in python can't find nothing similar - can found information should use os.open 0 or 1 value (as third argument)

maybe wrong way of thinking problem? know better idea show program output in own console?


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -