简体   繁体   English

python vte:获取派生进程的pid

[英]python vte: get the pid of the fork process

I'm using a vte term to run a bash script 我正在使用VTE术语来运行bash脚本

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 ? 如何获得pid的编号? I tried 我试过了

os.getpid()

but the pid is the number of my python program.. 但是pid是我的python程序的编号。

Thanks! 谢谢!

Solved... 解决了...

id = self.child_pid

Old question, instead of fork_command you now need spawn_sync : 老问题,现在需要spawn_sync而不是spawn_sync

https://lazka.github.io/pgi-docs/Vte-2.91/classes/Terminal.html#Vte.Terminal.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. spawn_sync返回一个tuple ,第二个元素是pid。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM