xonsh.procs.pipes

Pipe channel for single-owner fd management.

class xonsh.procs.pipes.PipeChannel(read_fd, write_fd)[source]

Single-owner pipe fd manager. Owner creates the pipe and is responsible for closing both ends. Consumers get non-owning wrappers via open_writer() / open_reader().

classmethod from_pipe()[source]

Create a PipeChannel from os.pipe().

classmethod from_pty()[source]

Create a PipeChannel from pty.openpty().

Falls back to os.pipe() if PTY devices are exhausted.

close()[source]

Close both ends.

close_reader()[source]

Close the read end fd. Thread-safe and idempotent.

close_writer()[source]

Close the write end fd. Thread-safe and idempotent.

open_reader(mode='rb', buffering=-1)[source]

Non-owning file wrapper for the read end.

open_writer(mode='wb', buffering=-1)[source]

Non-owning file wrapper for the write end.

property read_fd
property write_fd