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

KDEsu

process.h

Go to the documentation of this file.
00001 
00002 
00003 /* vi: ts=8 sts=4 sw=4
00004  *
00005  * This file is part of the KDE project, module kdesu.
00006  * Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
00007  * 
00008  * This is free software; you can use this library under the GNU Library 
00009  * General Public License, version 2. See the file "COPYING.LIB" for the 
00010  * exact licensing terms.
00011  */
00012 
00013 #ifndef __Process_h_Included__
00014 #define __Process_h_Included__
00015 
00016 #include <sys/types.h>
00017 
00018 #include <QtCore/QByteRef>
00019 #include <QtCore/QString>
00020 #include <QtCore/QStringList>
00021 #include <QtCore/QList>
00022 
00023 #include <kdesu/kdesu_export.h>
00024 
00025 #include <kpty.h>
00026 
00027 namespace KDESu {
00028 
00037 class KDESU_EXPORT PtyProcess
00038 {
00039 public:
00040     PtyProcess();
00041     virtual ~PtyProcess();
00042 
00051     int exec(const QByteArray &command, const QList<QByteArray> &args);
00052 
00061     QByteArray readLine(bool block=true);
00062 
00069     QByteArray readAll(bool block=true);
00070 
00076     void writeLine(const QByteArray &line, bool addNewline=true);
00077 
00083     void unreadLine(const QByteArray &line, bool addNewline=true);
00084 
00089     void setExitString(const QByteArray &exit);
00090 
00094     int waitForChild();
00095 
00101     int WaitSlave();
00102 
00106     int enableLocalEcho(bool enable=true);
00107 
00111     void setTerminal(bool terminal);
00112 
00117     void setErase(bool erase);
00118 
00122     void setEnvironment( const QList<QByteArray> &env );
00123 
00127     int fd() const;
00128 
00132     int pid() const;
00133 
00134 public /* static */:
00135     /*
00136     ** This is a collection of static functions that can be
00137     ** used for process control inside kdesu. I'd suggest
00138     ** against using this publicly. There are probably
00139     ** nicer Qt based ways to do what you want.
00140     */
00141 
00151     static int waitMS(int fd,int ms);
00152 
00153 
00159     static bool checkPid(pid_t pid);
00160 
00161 
00163     enum checkPidStatus { Error=-1,  
00164         NotExited=-2,                
00165         Killed=-3                    
00166     } ;
00167 
00175     static int checkPidExited(pid_t pid);
00176 
00177 
00178 protected:
00179     QList<QByteArray> environment() const;
00180 
00181     bool m_bErase,   
00182     m_bTerminal; 
00185     int m_Pid; 
00186     QByteArray m_Command,  
00187         m_Exit;            
00190 private:
00191     int init();
00192     int setupTTY();
00193 
00194 protected:
00196     virtual void virtual_hook( int id, void* data );
00197 private:
00198     class PtyProcessPrivate;
00199     PtyProcessPrivate* const d;
00200 };
00201 
00202 }
00203 
00204 #endif

KDEsu

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal