pub struct ProtocolChannel { /* private fields */ }Expand description
The helper process’s write half of the request/response protocol.
A loaded VST3 plugin shares the helper’s file descriptors, and third-party plugins do
print to stdout. Since the protocol is a line stream over the helper’s stdout, one stray
printf would be read by the host as a response and desynchronise every later exchange.
ProtocolChannel::claim therefore takes stdout away from the plugin: on Unix it
duplicates the inherited stdout onto a private, close-on-exec descriptor and repoints file
descriptor 1 at stderr, so plugin output is merged into the helper’s stderr instead. Call
it once, before any plugin code can run.
On non-Unix platforms the protocol still runs over the process stdout; a plugin writing there corrupts the stream (the host drops lines it cannot parse, which limits the damage to noise, but a well-formed line would still be taken for a response).
Implementations§
Trait Implementations§
Source§impl Write for ProtocolChannel
impl Write for ProtocolChannel
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored)