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) |
Protected Member Functions | |
virtual void | setupChildProcess () |
Protected Member Functions inherited from KProcess | |
KProcess (KProcessPrivate *d, QObject *parent) | |
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) |
Protected Attributes inherited from KProcess | |
KProcessPrivate *const | d_ptr |
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.
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-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:56 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.