Is the transport of the stdin readable or writable?

  • 0: readable streaming transport of the standard input (stdin), or None if the subprocess was not created with stdin=PIPE
  • 1: writable streaming transport of the standard output (stdout), or None if the subprocess was not created with stdout=PIPE
  • 2: writable streaming transport of the standard error (stderr), or None if the subprocess was not created with stderr=PIPE
  • other fd: None

While reading the documentation on SubprocessTransport.get_pipe_transport, I got confused because I usually write to stdin and read from stdout and stderr. This means that stdin is writable, while both stdout and stderr are readable.

From the subprocess’s perspective, stdin is readable, and both stdout and stderr are writable. However, from the transport’s perspective, they have the opposite roles.

Should the documentation describe stdin, stdout, and stderr from the transport’s perspective or the subprocess’s perspective?

Have you ever used Popen?

If yes, have you ever been confused that you write to its stdin and read from its stdout and stderr?

No, because Popen.stdin is documented as writable.

If the stdin argument was PIPE, this attribute is a writeable stream object as returned by open().