python vte: get the pid of the fork process

211 Views Asked by At

I'm using a vte term to run a bash script

self.child_pid = self.v.fork_command(None, ['/bin/bash', 'dPluzz-cli', dest, '-u', adresse])

How can I do to get the number of the pid ? I tried

os.getpid()

but the pid is the number of my python program..

Thanks!

Solved...

id = self.child_pid
1

There are 1 best solutions below

0
On

Old question, instead of fork_command you now need spawn_sync:

https://lazka.github.io/pgi-docs/Vte-2.91/classes/Terminal.html#Vte.Terminal.spawn_sync

spawn_sync returns a tuple, second element is pid.