KPty
#include <kptyprocess.h>
Public Types | |
enum | PtyChannelFlag { NoChannels = 0, StdinChannel = 1, StdoutChannel = 2, StderrChannel = 4, AllOutputChannels = 6, AllChannels = 7 } |
Public Types inherited from KProcess | |
enum | OutputChannelMode |
Public Member Functions | |
KPtyProcess (QObject *parent=0) | |
KPtyProcess (int ptyMasterFd, QObject *parent=0) | |
virtual | ~KPtyProcess () |
bool | isUseUtmp () const |
KPtyDevice * | pty () const |
PtyChannels | ptyChannels () const |
void | setPtyChannels (PtyChannels channels) |
void | setUseUtmp (bool value) |
Public Member Functions inherited from KProcess | |
KProcess (QObject *parent=0) | |
virtual | ~KProcess () |
void | clearEnvironment () |
void | clearProgram () |
int | execute (int msecs=-1) |
KProcess & | operator<< (const QString &arg) |
KProcess & | operator<< (const QStringList &args) |
OutputChannelMode | outputChannelMode () const |
int | pid () const |
QStringList | program () const |
void | setEnv (const QString &name, const QString &value, bool overwrite=true) |
void | setNextOpenMode (QIODevice::OpenMode mode) |
void | setOutputChannelMode (OutputChannelMode mode) |
void | setProgram (const QString &exe, const QStringList &args=QStringList()) |
void | setProgram (const QStringList &argv) |
void | setShellCommand (const QString &cmd) |
void | start () |
int | startDetached () |
void | unsetEnv (const QString &name) |
Public Member Functions inherited from QProcess | |
QProcess (QObject *parent) | |
virtual | ~QProcess () |
virtual bool | atEnd () const |
virtual qint64 | bytesAvailable () const |
virtual qint64 | bytesToWrite () const |
virtual bool | canReadLine () const |
virtual void | close () |
void | closeReadChannel (ProcessChannel channel) |
void | closeWriteChannel () |
QStringList | environment () const |
void | error (QProcess::ProcessError error) |
QProcess::ProcessError | error () const |
int | exitCode () const |
QProcess::ExitStatus | exitStatus () const |
void | finished (int exitCode, QProcess::ExitStatus exitStatus) |
void | finished (int exitCode) |
virtual bool | isSequential () const |
void | kill () |
QString | nativeArguments () const |
Q_PID | pid () const |
ProcessChannelMode | processChannelMode () const |
QProcessEnvironment | processEnvironment () const |
QByteArray | readAllStandardError () |
QByteArray | readAllStandardOutput () |
ProcessChannel | readChannel () const |
ProcessChannelMode | readChannelMode () const |
void | readyReadStandardError () |
void | readyReadStandardOutput () |
void | setEnvironment (const QStringList &environment) |
void | setNativeArguments (const QString &arguments) |
void | setProcessChannelMode (ProcessChannelMode mode) |
void | setProcessEnvironment (const QProcessEnvironment &environment) |
void | setReadChannel (ProcessChannel channel) |
void | setReadChannelMode (ProcessChannelMode mode) |
void | setStandardErrorFile (const QString &fileName, QFlags< QIODevice::OpenModeFlag > mode) |
void | setStandardInputFile (const QString &fileName) |
void | setStandardOutputFile (const QString &fileName, QFlags< QIODevice::OpenModeFlag > mode) |
void | setStandardOutputProcess (QProcess *destination) |
void | setWorkingDirectory (const QString &dir) |
void | start (const QString &program, const QStringList &arguments, QFlags< QIODevice::OpenModeFlag > mode) |
void | start (const QString &program, QFlags< QIODevice::OpenModeFlag > mode) |
void | started () |
QProcess::ProcessState | state () const |
void | stateChanged (QProcess::ProcessState newState) |
void | terminate () |
virtual bool | waitForBytesWritten (int msecs) |
bool | waitForFinished (int msecs) |
virtual bool | waitForReadyRead (int msecs) |
bool | waitForStarted (int msecs) |
QString | workingDirectory () const |
Public Member Functions inherited from QIODevice | |
QIODevice () | |
QIODevice (QObject *parent) | |
virtual | ~QIODevice () |
void | aboutToClose () |
Offset | at () const |
bool | at (Offset offset) |
void | bytesWritten (qint64 bytes) |
QString | errorString () const |
int | flags () const |
int | getch () |
bool | getChar (char *c) |
bool | isAsynchronous () const |
bool | isBuffered () const |
bool | isCombinedAccess () const |
bool | isDirectAccess () const |
bool | isInactive () const |
bool | isOpen () const |
bool | isRaw () const |
bool | isReadable () const |
bool | isSequentialAccess () const |
bool | isSynchronous () const |
bool | isTextModeEnabled () const |
bool | isTranslated () const |
bool | isWritable () const |
int | mode () const |
virtual bool | open (QFlags< QIODevice::OpenModeFlag > mode) |
OpenMode | openMode () const |
qint64 | peek (char *data, qint64 maxSize) |
QByteArray | peek (qint64 maxSize) |
virtual qint64 | pos () const |
int | putch (int ch) |
bool | putChar (char c) |
qint64 | read (char *data, qint64 maxSize) |
QByteArray | read (qint64 maxSize) |
QByteArray | readAll () |
qint64 | readBlock (char *data, quint64 size) |
void | readChannelFinished () |
QByteArray | readLine (qint64 maxSize) |
qint64 | readLine (char *data, qint64 maxSize) |
void | readyRead () |
virtual bool | reset () |
void | resetStatus () |
virtual bool | seek (qint64 pos) |
void | setTextModeEnabled (bool enabled) |
virtual qint64 | size () const |
int | state () const |
Status | status () const |
int | ungetch (int ch) |
void | ungetChar (char c) |
qint64 | write (const char *data) |
qint64 | write (const char *data, qint64 maxSize) |
qint64 | write (const QByteArray &byteArray) |
qint64 | writeBlock (const QByteArray &data) |
qint64 | writeBlock (const char *data, quint64 size) |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QObject (QObject *parent, const char *name) | |
virtual | ~QObject () |
bool | blockSignals (bool block) |
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
const QObjectList & | children () const |
const char * | className () const |
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const QObject *receiver, const char *method) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) const |
QList< T > | findChildren (const QString &name) const |
bool | inherits (const char *className) const |
void | insertChild (QObject *object) |
void | installEventFilter (QObject *filterObj) |
bool | isA (const char *className) const |
bool | isWidgetType () const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () const |
QVariant | property (const char *name) const |
void | removeChild (QObject *object) |
void | removeEventFilter (QObject *obj) |
void | setName (const char *name) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval) |
QThread * | thread () const |
Protected Member Functions | |
virtual void | setupChildProcess () |
Protected Member Functions inherited from KProcess | |
KProcess (KProcessPrivate *d, QObject *parent) | |
Protected Member Functions inherited from QProcess | |
virtual qint64 | readData (char *data, qint64 maxlen) |
void | setProcessState (ProcessState state) |
virtual qint64 | writeData (const char *data, qint64 len) |
Protected Member Functions inherited from QIODevice | |
virtual qint64 | readData (char *data, qint64 maxSize)=0 |
virtual qint64 | readLineData (char *data, qint64 maxSize) |
void | setErrorString (const QString &str) |
void | setOpenMode (QFlags< QIODevice::OpenModeFlag > openMode) |
virtual qint64 | writeData (const char *data, qint64 maxSize)=0 |
Protected Member Functions inherited from QObject | |
bool | checkConnectArgs (const char *signal, const QObject *object, const char *method) |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const char *signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const char *signal) |
int | receivers (const char *signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Additional Inherited Members | |
Static Public Member Functions inherited from KProcess | |
static int | execute (const QString &exe, const QStringList &args=QStringList(), int msecs=-1) |
static int | execute (const QStringList &argv, int msecs=-1) |
static int | startDetached (const QString &exe, const QStringList &args=QStringList()) |
static int | startDetached (const QStringList &argv) |
Static Public Member Functions inherited from QProcess | |
int | execute (const QString &program, const QStringList &arguments) |
int | execute (const QString &program) |
bool | startDetached (const QString &program) |
bool | startDetached (const QString &program, const QStringList &arguments) |
bool | startDetached (const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid) |
QStringList | systemEnvironment () |
Static Public Member Functions inherited from QObject | |
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Public Attributes inherited from QIODevice | |
typedef | Offset |
typedef | OpenMode |
typedef | Status |
Static Protected Member Functions inherited from QObject | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
Protected Attributes inherited from KProcess | |
KProcessPrivate *const | d_ptr |
Properties inherited from QObject | |
objectName | |
Detailed Description
This class extends KProcess by support for PTYs (pseudo TTYs).
The PTY is opened as soon as the class is instantiated. Verify that it was opened successfully by checking that pty()->masterFd() is not -1.
The PTY is always made the process' controlling TTY. Utmp registration and connecting the stdio handles to the PTY are optional.
No attempt to integrate with QProcess' waitFor*() functions was made, for it is impossible. Note that execute() does not work with the PTY, too. Use the PTY device's waitFor*() functions or use it asynchronously.
Definition at line 48 of file kptyprocess.h.
Member Enumeration Documentation
Definition at line 54 of file kptyprocess.h.
Constructor & Destructor Documentation
|
explicit |
Constructor.
Definition at line 54 of file kptyprocess.cpp.
KPtyProcess::KPtyProcess | ( | int | ptyMasterFd, |
QObject * | parent = 0 |
||
) |
Construct a process using an open pty master.
- Parameters
-
ptyMasterFd an open pty master file descriptor. The process does not take ownership of the descriptor; it will not be automatically closed at any point.
Definition at line 65 of file kptyprocess.cpp.
|
virtual |
Destructor.
Definition at line 76 of file kptyprocess.cpp.
Member Function Documentation
bool KPtyProcess::isUseUtmp | ( | ) | const |
Get whether to register the process as a TTY login in utmp.
- Returns
- whether to register in utmp
Definition at line 109 of file kptyprocess.cpp.
KPtyDevice * KPtyProcess::pty | ( | ) | const |
Get the PTY device of this process.
- Returns
- the PTY device
Definition at line 116 of file kptyprocess.cpp.
KPtyProcess::PtyChannels KPtyProcess::ptyChannels | ( | ) | const |
Query to which channels the PTY is assigned.
- Returns
- the output channel handling mode
Definition at line 95 of file kptyprocess.cpp.
void KPtyProcess::setPtyChannels | ( | PtyChannels | channels | ) |
Set to which channels the PTY should be assigned.
This function must be called before starting the process.
- Parameters
-
channels the output channel handling mode
Definition at line 88 of file kptyprocess.cpp.
|
protectedvirtual |
- Reimplemented from superclass.
Reimplemented from QProcess.
Definition at line 123 of file kptyprocess.cpp.
void KPtyProcess::setUseUtmp | ( | bool | value | ) |
Set whether to register the process as a TTY login in utmp.
Utmp is disabled by default. It should enabled for interactively fed processes, like terminal emulations.
This function must be called before starting the process.
- Parameters
-
value whether to register in utmp.
Definition at line 102 of file kptyprocess.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:38 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.