stc
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
stc::Unix::PTY Struct Reference

#include <Process.hpp>

Inheritance diagram for stc::Unix::PTY:
stc::Unix::LowLevelWrapper

Public Member Functions

 PTY ()
 
 ~PTY ()
 
void die ()
 
void closeMasterChannel ()
 
void closeSlaveChannel ()
 
ssize_t writeToStdin (const std::string &data)
 
ssize_t readData (std::stringstream &out)
 
- Public Member Functions inherited from stc::Unix::LowLevelWrapper
ssize_t writeToFd (const std::string &data, int fd)
 
ssize_t readFromFd (std::stringstream &out, int fd)
 

Public Attributes

int master
 
int slave
 

Constructor & Destructor Documentation

◆ PTY()

stc::Unix::PTY::PTY ( )
inline

◆ ~PTY()

stc::Unix::PTY::~PTY ( )
inline

Member Function Documentation

◆ closeMasterChannel()

void stc::Unix::PTY::closeMasterChannel ( )
inline

◆ closeSlaveChannel()

void stc::Unix::PTY::closeSlaveChannel ( )
inline

◆ die()

void stc::Unix::PTY::die ( )
inline

Can be used to close the PTY. This should usually not be done unless you have an explicit reason to force-terminate it. This is primarily intended to be called internally by the child process, as destructors are not invoked with exec.

See also
https://stackoverflow.com/a/17135211

◆ readData()

ssize_t stc::Unix::PTY::readData ( std::stringstream &  out)
inline

◆ writeToStdin()

ssize_t stc::Unix::PTY::writeToStdin ( const std::string &  data)
inline

Note: this function only writes to the master channel, as it's assumed the result of fork() never returns control back to the code executed by stc. DO NOT USE THIS STRUCT IF YOU BREAK THIS ASSUMPTION! Shit will get weird. Reimplement it from scratch, or open a PR to make this API better.

Member Data Documentation

◆ master

int stc::Unix::PTY::master

◆ slave

int stc::Unix::PTY::slave

The documentation for this struct was generated from the following file: