• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KPty

Public Types | Public Member Functions | Protected Member Functions | List of all members
KPtyProcess Class Reference

#include <kptyprocess.h>

Inheritance diagram for KPtyProcess:
Inheritance graph
[legend]

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.

Author
Oswald Buddenhagen ossi@.nosp@m.kde..nosp@m.org

Definition at line 48 of file kptyprocess.h.

Member Enumeration Documentation

enum KPtyProcess::PtyChannelFlag
Enumerator
NoChannels 

The PTY is not connected to any channel.

StdinChannel 

Connect PTY to stdin.

StdoutChannel 

Connect PTY to stdout.

StderrChannel 

Connect PTY to stderr.

AllOutputChannels 

Connect PTY to all output channels.

AllChannels 

Connect PTY to all channels.

Definition at line 54 of file kptyprocess.h.

Constructor & Destructor Documentation

KPtyProcess::KPtyProcess ( QObject *  parent = 0)
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
ptyMasterFdan 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.

KPtyProcess::~KPtyProcess ( )
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
channelsthe output channel handling mode

Definition at line 88 of file kptyprocess.cpp.

void KPtyProcess::setupChildProcess ( )
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
valuewhether to register in utmp.

Definition at line 102 of file kptyprocess.cpp.


The documentation for this class was generated from the following files:
  • kptyprocess.h
  • kptyprocess.cpp
This file is part of the KDE documentation.
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.

KPty

Skip menu "KPty"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal