TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Subprocess: Don't close all file descriptors by default (close_fds=False)

35 点作者 luu5 个月前

9 条评论

htfy965 个月前
Meanwhile VSCode&#x27;s terminal still leaks Electron fds: <a href="https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;node-pty&#x2F;issues&#x2F;657">https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;node-pty&#x2F;issues&#x2F;657</a><p>I get this proposal&#x27;s rationale, but it seems that it would implicitly make fd leaks more prone in python programs
oseityphelysiol5 个月前
Of all the quirks with process spawning in posix keeping file descriptors open is the most problematic one I encountered. This bit into my ass while implementing a C library to have proper process spawning and stdio handling in LUA. I really wish file descriptors were non inheritable by default.
评论 #42517110 未加载
teddyh5 个月前
The counter-arguments presented seem persuasive. This was originally submitted in 2020, and closed in 2022. Why is it relevant or interesting today?
评论 #42517652 未加载
williamjackson5 个月前
<a href="https:&#x2F;&#x2F;github.com&#x2F;python&#x2F;cpython&#x2F;issues&#x2F;86904">https:&#x2F;&#x2F;github.com&#x2F;python&#x2F;cpython&#x2F;issues&#x2F;86904</a>
评论 #42517123 未加载
nasretdinov5 个月前
Go goes slightly further and opens all descriptors with O_CLOEXEC by default, so if you ever execute an external command you have to go out of your way to preserve any descriptors, which is really nice in my opinion
评论 #42517435 未加载
mmastrac5 个月前
FDs really should have been opt-in for inheritability from the start, with the possible exception of stdio. Inheritability being an fcntl is definitely one of the worst bits -- if the APIs for fork()&#x2F;etc were designed today it would probably take a list of FDs that would be dup2&#x27;d in the new child process.
评论 #42517328 未加载
评论 #42517426 未加载
评论 #42519074 未加载
loeg5 个月前
(2020), or perhaps 2021.
Pesthuf5 个月前
&gt; On macOS, posix_spawn() is even a syscall.<p>First time I hear about this, interesting. I wonder what the performance benefits are like.
zitterbewegung5 个月前
Dang: Link should be <a href="https:&#x2F;&#x2F;github.com&#x2F;python&#x2F;cpython&#x2F;issues&#x2F;86904">https:&#x2F;&#x2F;github.com&#x2F;python&#x2F;cpython&#x2F;issues&#x2F;86904</a>