[issue46454] '0 -> /dev/null' is lost

2022-01-21 Thread licunlong
licunlong added the comment: But one more question. Please take a look at fd.py. In this file, we first close fd 0, then open /dev/null as fd_null, and dump fd_null to fd 0. After we fork new process, this fd 0 `is` inherited. This seems to be a bug? -- nosy: +Geass-LL

[issue46454] '0 -> /dev/null' is lost

2022-01-21 Thread licunlong
licunlong added the comment: > File descriptors 0, 1, 2 are special: stdin, stdout and stderr file > descriptors. You should use stdin, stdout, and stderr parameter of subprocess. I finally find why `fd 0` is inherited. The reason is that os.dup2() has a parameter "inherit