libzypp
17.34.1
|
#include <zypp-core/zyppng/io/process.h>
Public Types | |
enum | OutputChannelMode { Seperate, Merged } |
enum | OutputChannel { StdOut = 0, StdErr = 1 } |
using | Environment = std::map< std::string, std::string > |
For passing additional environment variables to set. More... | |
using | Ptr = std::shared_ptr< Process > |
using | WeakPtr = std::weak_ptr< Process > |
![]() | |
enum | ChannelCloseReason { RemoteClose, AccessError, InternalError, UserRequest } |
using | Ptr = std::shared_ptr< AsyncDataSource > |
using | WeakPtr = std::weak_ptr< AsyncDataSource > |
![]() | |
enum | OpenModeFlag { Closed = 0x0, ReadOnly = 0x1, WriteOnly = 0x2, ReadWrite = ReadOnly | WriteOnly } |
using | Ptr = std::shared_ptr< IODevice > |
using | WeakPtr = std::weak_ptr< IODevice > |
![]() | |
using | Ptr = std::shared_ptr< Base > |
using | WeakPtr = std::weak_ptr< Base > |
Public Member Functions | |
~Process () override | |
bool | start (const char *const *argv) |
void | stop (int signal=SIGTERM) |
bool | isRunning () |
void | close () override |
void | waitForExit () |
void | closeWriteChannel () override |
const std::string & | executedCommand () const |
const std::string & | execError () const |
zypp::Pathname | chroot () const |
void | setChroot (const zypp::Pathname &chroot) |
bool | useDefaultLocale () const |
void | setUseDefaultLocale (bool defaultLocale) |
Environment | environment () const |
void | setEnvironment (const Environment &environment) |
pid_t | pid () |
int | exitStatus () const |
bool | dieWithParent () const |
void | setDieWithParent (bool enabled) |
bool | switchPgid () const |
void | setSwitchPgid (bool enabled) |
zypp::Pathname | workingDirectory () const |
void | setWorkingDirectory (const zypp::Pathname &workingDirectory) |
const std::vector< int > & | fdsToMap () const |
void | addFd (int fd) |
int | stdinFd () |
int | stdoutFd () |
int | stderrFd () |
SignalProxy< void()> | sigStarted () |
SignalProxy< void()> | sigFailedToStart () |
SignalProxy< void(int)> | sigFinished () |
OutputChannelMode | outputChannelMode () const |
void | setOutputChannelMode (const OutputChannelMode &outputChannelMode) |
![]() | |
bool | openFds (const std::vector< int > &readFds, int writeFd=-1) |
bool | waitForReadyRead (uint channel, int timeout) override |
void | flush () |
SignalProxy< void(AsyncDataSource::ChannelCloseReason)> | sigWriteFdClosed () |
SignalProxy< void(uint, AsyncDataSource::ChannelCloseReason)> | sigReadFdClosed () |
bool | readFdOpen () const |
bool | readFdOpen (uint channel) const |
bool | waitForReadyRead (int timeout) |
virtual bool | waitForReadyRead (uint channel, int timeout)=0 |
![]() | |
ZYPP_DECLARE_FLAGS (OpenMode, OpenModeFlag) | |
IODevice () | |
void | setReadChannel (uint channel) |
uint | currentReadChannel () const |
int | readChannelCount () const |
bool | canRead () const |
bool | canWrite () const |
bool | isOpen () const |
ByteArray | readAll () |
ByteArray | read (int64_t maxSize) |
int64_t | read (char *buf, int64_t maxSize) |
virtual ByteArray | readLine (const int64_t maxSize=0) |
virtual int64_t | bytesAvailable () const |
bool | canReadLine () const |
ByteArray | readAll (uint channel) |
ByteArray | read (uint channel, int64_t maxSize) |
int64_t | read (uint channel, char *buf, int64_t maxSize) |
ByteArray | channelReadLine (uint channel, int64_t maxSize=0) |
virtual int64_t | channelReadLine (uint channel, char *buf, const int64_t maxSize) |
virtual int64_t | bytesAvailable (uint channel) const |
bool | canReadLine (uint channel) const |
int64_t | write (const ByteArray &data) |
int64_t | write (const char *data, int64_t len) |
bool | waitForReadyRead (int timeout) |
SignalProxy< void()> | sigReadyRead () |
SignalProxy< void(uint)> | sigChannelReadyRead () |
SignalProxy< void(int64_t)> | sigBytesWritten () |
SignalProxy< void()> | sigAllBytesWritten () |
![]() | |
Base () | |
virtual | ~Base () |
WeakPtr | parent () const |
void | addChild (const Base::Ptr &child) |
void | removeChild (const Ptr &child) |
const std::unordered_set< Ptr > & | children () const |
std::thread::id | threadId () const |
template<typename T > | |
std::vector< std::weak_ptr< T > > | findChildren () const |
template<typename T > | |
std::shared_ptr< T > | shared_this () const |
template<typename T > | |
std::shared_ptr< T > | shared_this () |
template<typename T > | |
std::weak_ptr< T > | weak_this () const |
template<typename T > | |
std::weak_ptr< T > | weak_this () |
template<typename SenderFunc , typename ReceiverFunc > | |
auto | connect (SenderFunc &&sFun, typename internal::MemberFunction< ReceiverFunc >::ClassType &recv, ReceiverFunc &&rFunc) |
template<typename SenderFunc , typename ReceiverFunc , typename ... Tracker> | |
std::enable_if_t< std::is_member_function_pointer_v< SenderFunc >, connection > | connectFunc (SenderFunc &&sFun, ReceiverFunc &&rFunc, const Tracker &...trackers) |
Static Public Member Functions | |
static Ptr | create () |
![]() | |
static Ptr | create () |
![]() | |
template<typename Obj , typename Functor > | |
static decltype(auto) | make_base_slot (Obj *o, Functor &&f) |
template<typename SenderFunc , typename ReceiverFunc > | |
static auto | connect (typename internal::MemberFunction< SenderFunc >::ClassType &s, SenderFunc &&sFun, typename internal::MemberFunction< ReceiverFunc >::ClassType &recv, ReceiverFunc &&rFunc) |
template<typename SenderFunc , typename ReceiverFunc , typename ... Tracker> | |
static auto | connectFunc (typename internal::MemberFunction< SenderFunc >::ClassType &s, SenderFunc &&sFun, ReceiverFunc &&rFunc, const Tracker &...trackers) |
Protected Member Functions | |
Process () | |
![]() | |
AsyncDataSource () | |
AsyncDataSource (AsyncDataSourcePrivate &d) | |
int64_t | writeData (const char *data, int64_t count) override |
![]() | |
IODevice (IODevicePrivate &d) | |
virtual bool | open (const OpenMode mode) |
void | setReadChannelCount (uint channels) |
![]() | |
Base (BasePrivate &dd) | |
Private Member Functions | |
ZYPP_DECLARE_PRIVATE (Process) | |
Additional Inherited Members | |
![]() | |
std::unique_ptr< BasePrivate > | d_ptr |
using zyppng::Process::Environment = std::map<std::string,std::string> |
using zyppng::Process::Ptr = std::shared_ptr<Process> |
using zyppng::Process::WeakPtr = std::weak_ptr<Process> |
|
override |
Definition at line 52 of file process.cpp.
|
protected |
Definition at line 42 of file process.cpp.
|
private |
|
static |
Definition at line 47 of file process.cpp.
bool zyppng::Process::start | ( | const char *const * | argv | ) |
Definition at line 61 of file process.cpp.
void zyppng::Process::stop | ( | int | signal = SIGTERM | ) |
Definition at line 137 of file process.cpp.
bool zyppng::Process::isRunning | ( | ) |
Definition at line 145 of file process.cpp.
|
overridevirtual |
Reimplemented from zyppng::AsyncDataSource.
Definition at line 151 of file process.cpp.
void zyppng::Process::waitForExit | ( | ) |
Blocks until the process has exited, during that time readyRead is not emitted for any read channels. Call readAll to get all remaining data that was written by the process
Definition at line 159 of file process.cpp.
|
overridevirtual |
Close the stdin fd of the subprocess. This is required for processes that run until their stdin is closed.
Reimplemented from zyppng::AsyncDataSource.
Definition at line 170 of file process.cpp.
const std::string & zyppng::Process::executedCommand | ( | ) | const |
Definition at line 177 of file process.cpp.
const std::string & zyppng::Process::execError | ( | ) | const |
Definition at line 182 of file process.cpp.
zypp::filesystem::Pathname zyppng::Process::chroot | ( | ) | const |
Definition at line 187 of file process.cpp.
void zyppng::Process::setChroot | ( | const zypp::Pathname & | chroot | ) |
Definition at line 192 of file process.cpp.
bool zyppng::Process::useDefaultLocale | ( | ) | const |
Definition at line 197 of file process.cpp.
void zyppng::Process::setUseDefaultLocale | ( | bool | defaultLocale | ) |
Definition at line 202 of file process.cpp.
Process::Environment zyppng::Process::environment | ( | ) | const |
Definition at line 207 of file process.cpp.
void zyppng::Process::setEnvironment | ( | const Environment & | environment | ) |
Definition at line 212 of file process.cpp.
pid_t zyppng::Process::pid | ( | ) |
Definition at line 217 of file process.cpp.
int zyppng::Process::exitStatus | ( | ) | const |
Definition at line 222 of file process.cpp.
bool zyppng::Process::dieWithParent | ( | ) | const |
Definition at line 227 of file process.cpp.
void zyppng::Process::setDieWithParent | ( | bool | enabled | ) |
Definition at line 232 of file process.cpp.
bool zyppng::Process::switchPgid | ( | ) | const |
Definition at line 237 of file process.cpp.
void zyppng::Process::setSwitchPgid | ( | bool | enabled | ) |
Definition at line 242 of file process.cpp.
zypp::filesystem::Pathname zyppng::Process::workingDirectory | ( | ) | const |
Definition at line 247 of file process.cpp.
void zyppng::Process::setWorkingDirectory | ( | const zypp::Pathname & | workingDirectory | ) |
Definition at line 252 of file process.cpp.
const std::vector< int > & zyppng::Process::fdsToMap | ( | ) | const |
Definition at line 257 of file process.cpp.
void zyppng::Process::addFd | ( | int | fd | ) |
Definition at line 262 of file process.cpp.
int zyppng::Process::stdinFd | ( | ) |
Definition at line 267 of file process.cpp.
int zyppng::Process::stdoutFd | ( | ) |
Definition at line 272 of file process.cpp.
int zyppng::Process::stderrFd | ( | ) |
Definition at line 277 of file process.cpp.
SignalProxy< void()> zyppng::Process::sigStarted | ( | ) |
Definition at line 282 of file process.cpp.
SignalProxy< void()> zyppng::Process::sigFailedToStart | ( | ) |
Definition at line 287 of file process.cpp.
SignalProxy< void(int)> zyppng::Process::sigFinished | ( | ) |
Definition at line 292 of file process.cpp.
Process::OutputChannelMode zyppng::Process::outputChannelMode | ( | ) | const |
Definition at line 297 of file process.cpp.
void zyppng::Process::setOutputChannelMode | ( | const OutputChannelMode & | outputChannelMode | ) |
Definition at line 298 of file process.cpp.