How can I run an interactive program (like gdb) from python?

I am going to run gdb from python.

For instance:

prog.shell.py:
    #do lots of things
    #
    #
    p.subprocess.Popen("gdb --args myprog", shell=True, stdin=sys.stdin, stdout=sys.stdout)

      

But gdb is not being called as I expected, communication with gdb is broken. I've also tried os.system (), but it still doesn't work. What could I be doing wrong?

+1


a source to share


1 answer


I think you meant

p = subprocess.Popen(...)

      



You probably need to wait for p to complete:

p.wait()

      

+3


a source







All Articles