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

KDEsu

  • sources
  • kde-4.12
  • kdelibs
  • kdesu
process.h
Go to the documentation of this file.
1 
3 /* vi: ts=8 sts=4 sw=4
4  *
5  * This file is part of the KDE project, module kdesu.
6  * Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
7  *
8  * This is free software; you can use this library under the GNU Library
9  * General Public License, version 2. See the file "COPYING.LIB" for the
10  * exact licensing terms.
11  */
12 
13 #ifndef __Process_h_Included__
14 #define __Process_h_Included__
15 
16 #include <sys/types.h>
17 
18 #include <QtCore/QByteRef>
19 #include <QtCore/QString>
20 #include <QtCore/QStringList>
21 #include <QtCore/QList>
22 
23 #include <kdesu/kdesu_export.h>
24 
25 #include <kpty.h>
26 
27 namespace KDESu {
28 
37 class KDESU_EXPORT PtyProcess
38 {
39 public:
40  PtyProcess();
41  virtual ~PtyProcess();
42 
51  int exec(const QByteArray &command, const QList<QByteArray> &args);
52 
61  QByteArray readLine(bool block=true);
62 
69  QByteArray readAll(bool block=true);
70 
76  void writeLine(const QByteArray &line, bool addNewline=true);
77 
83  void unreadLine(const QByteArray &line, bool addNewline=true);
84 
89  void setExitString(const QByteArray &exit);
90 
94  int waitForChild();
95 
101  int WaitSlave();
102 
106  int enableLocalEcho(bool enable=true);
107 
111  void setTerminal(bool terminal);
112 
117  void setErase(bool erase);
118 
122  void setEnvironment( const QList<QByteArray> &env );
123 
127  int fd() const;
128 
132  int pid() const;
133 
134 public /* static */:
135  /*
136  ** This is a collection of static functions that can be
137  ** used for process control inside kdesu. I'd suggest
138  ** against using this publicly. There are probably
139  ** nicer Qt based ways to do what you want.
140  */
141 
151  static int waitMS(int fd,int ms);
152 
153 
159  static bool checkPid(pid_t pid);
160 
161 
163  enum checkPidStatus { Error=-1,
164  NotExited=-2,
165  Killed=-3
166  } ;
167 
175  static int checkPidExited(pid_t pid);
176 
177 
178 protected:
179  QList<QByteArray> environment() const;
180 
181  bool m_bErase,
182  m_bTerminal;
185  int m_Pid;
186  QByteArray m_Command,
187  m_Exit;
190 private:
191  int init();
192  int setupTTY();
193 
194 protected:
196  virtual void virtual_hook( int id, void* data );
197 private:
198  class PtyProcessPrivate;
199  PtyProcessPrivate* const d;
200 };
201 
202 }
203 
204 #endif
KDESu::PtyProcess::m_bTerminal
bool m_bTerminal
Indicates running in a terminal, causes additional newlines to be printed after output.
Definition: process.h:181
KDESu::PtyProcess
Synchronous communication with tty programs.
Definition: process.h:37
kdesu_export.h
KDESu::PtyProcess::m_Pid
int m_Pid
PID of child process.
Definition: process.h:185
Error
KDESu::PtyProcess::m_Exit
QByteArray m_Exit
String to scan for in output that indicates child has exited.
Definition: process.h:186
KDESu::PtyProcess::checkPidStatus
checkPidStatus
Error return values for checkPidExited()
Definition: process.h:163
QList< QByteArray >
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:48 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEsu

Skip menu "KDEsu"
  • Main Page
  • Namespace List
  • Namespace Members
  • 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