Python 3与PID连接到运行过程

发布于 2025-01-30 08:39:54 字数 142 浏览 2 评论 0原文

我有一些使用subprocess.popen执行命令,脚本等的代码。如果父母python脚本意外结束,我一直在寻找一种重新构成基础过程的方法,以继续监视它。我们在Linux和Windows上都运行此代码。我们将拥有PID,我们将尝试重新构成该过程,这是启动该过程的用户。

I have some code that uses subprocess.Popen to execute a command, script, etc. I have been looking for a way to reattach to the underlying process to continue monitoring it if the parent python script ended unexpectedly. We have this code running on both Linux and Windows. We would have the PID and we would be trying to reattach to the process as the same user that started the process.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文