\section{KProcess Class Reference}
\label{classKProcess}\index{KProcess@{KProcess}}
Child process invocation, monitoring and control.  


{\tt \#include $<$kprocess.h$>$}

Inheritance diagram for KProcess:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=94pt]{classKProcess__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KProcess:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=166pt]{classKProcess__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum {\bf Communication} \{ \par
{\bf No\-Communication} =  0, 
{\bf Stdin} =  1, 
{\bf Stdout} =  2, 
{\bf Stderr} =  4, 
\par
{\bf All\-Output} =  6, 
{\bf All} =  7, 
{\bf No\-Read}
 \}
\item 
enum {\bf Run\-Mode} \{ {\bf Dont\-Care}, 
{\bf Notify\-On\-Exit}, 
{\bf Block}, 
{\bf Own\-Group}
 \}
\item 
enum \{ \par
{\bf Prio\-Lowest} =  20, 
{\bf Prio\-Low} =  10, 
{\bf Prio\-Lower} =  5, 
{\bf Prio\-Normal} =  0, 
\par
{\bf Prio\-Higher} =  -5, 
{\bf Prio\-High} =  -10, 
{\bf Prio\-Highest} =  -19
 \}
\end{CompactItemize}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf process\-Exited} ({\bf KProcess} $\ast$proc)
\item 
void {\bf received\-Stdout} ({\bf KProcess} $\ast$proc, char $\ast$buffer, int buflen)
\item 
void {\bf received\-Stdout} (int fd, int \&len)
\item 
void {\bf received\-Stderr} ({\bf KProcess} $\ast$proc, char $\ast$buffer, int buflen)
\item 
void {\bf wrote\-Stdin} ({\bf KProcess} $\ast$proc)
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KProcess} ({\bf QObject} $\ast${\bf parent}, const char $\ast${\bf name}=0)
\item 
{\bf KProcess} ()
\item 
virtual {\bf $\sim$KProcess} ()
\item 
bool {\bf set\-Executable} (const {\bf QString} \&proc) KDE\_\-DEPRECATED
\item 
{\bf KProcess} \& {\bf operator$<$$<$} (const {\bf QString} \&arg)
\item 
{\bf KProcess} \& {\bf operator$<$$<$} (const char $\ast$arg)
\item 
{\bf KProcess} \& {\bf operator$<$$<$} (const {\bf QCString} \&arg)
\item 
{\bf KProcess} \& {\bf operator$<$$<$} (const {\bf QString\-List} \&args)
\item 
void {\bf clear\-Arguments} ()
\item 
virtual bool {\bf start} ({\bf Run\-Mode} runmode=Notify\-On\-Exit, {\bf Communication} comm=No\-Communication)
\item 
virtual bool {\bf kill} (int signo=SIGTERM)
\item 
bool {\bf is\-Running} () const 
\item 
pid\_\-t {\bf pid} () const 
\item 
KDE\_\-DEPRECATED pid\_\-t {\bf get\-Pid} () const 
\item 
void {\bf suspend} ()
\item 
void {\bf resume} ()
\item 
bool {\bf wait} (int timeout=-1)
\item 
bool {\bf normal\-Exit} () const 
\item 
bool {\bf signalled} () const 
\item 
bool {\bf core\-Dumped} () const 
\item 
int {\bf exit\-Status} () const 
\item 
int {\bf exit\-Signal} () const 
\item 
bool {\bf write\-Stdin} (const char $\ast$buffer, int buflen)
\item 
bool {\bf close\-Stdin} ()
\item 
bool {\bf close\-Stdout} ()
\item 
bool {\bf close\-Stderr} ()
\item 
bool {\bf close\-Pty} ()
\item 
void {\bf close\-All} ()
\item 
const {\bf QValue\-List}$<$ {\bf QCString} $>$ \& {\bf args} ()
\item 
void {\bf set\-Run\-Privileged} (bool keep\-Privileges)
\item 
bool {\bf run\-Privileged} () const 
\item 
void {\bf set\-Environment} (const {\bf QString} \&{\bf name}, const {\bf QString} \&value)
\item 
void {\bf set\-Working\-Directory} (const {\bf QString} \&dir)
\item 
void {\bf set\-Use\-Shell} (bool use\-Shell, const char $\ast$shell=0)
\item 
void {\bf detach} ()
\item 
bool {\bf set\-Priority} (int prio)
\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static {\bf QString} {\bf quote} (const {\bf QString} \&arg)
\end{CompactItemize}
\subsection*{Protected Slots}
\begin{CompactItemize}
\item 
void {\bf slot\-Child\-Output} (int fdno)
\item 
void {\bf slot\-Child\-Error} (int fdno)
\item 
void {\bf slot\-Send\-Data} (int dummy)
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
void {\bf setup\-Environment} ()
\item 
virtual int {\bf setup\-Communication} ({\bf Communication} comm)
\item 
virtual int {\bf comm\-Setup\-Done\-P} ()
\item 
virtual int {\bf comm\-Setup\-Done\-C} ()
\item 
virtual void {\bf process\-Has\-Exited} (int state)
\item 
virtual void {\bf comm\-Close} ()
\item 
void {\bf set\-Binary\-Executable} (const char $\ast$filename)
\item 
int {\bf child\-Output} (int fdno)
\item 
int {\bf child\-Error} (int fdno)
\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKProcess_b9}

\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
{\bf QValue\-List}$<$ {\bf QCString} $>$ {\bf arguments}
\item 
{\bf Run\-Mode} {\bf run\_\-mode}
\item 
bool {\bf runs}
\item 
pid\_\-t {\bf pid\_\-}
\item 
int {\bf status}
\item 
bool {\bf keep\-Privs}
\item 
int {\bf out} [2]
\item 
int {\bf in} [2]
\item 
int {\bf err} [2]
\item 
{\bf QSocket\-Notifier} $\ast$ {\bf innot}
\item 
{\bf QSocket\-Notifier} $\ast$ {\bf outnot}
\item 
{\bf QSocket\-Notifier} $\ast$ {\bf errnot}
\item 
{\bf Communication} {\bf communication}
\item 
const char $\ast$ {\bf input\_\-data}
\item 
int {\bf input\_\-sent}
\item 
int {\bf input\_\-total}
\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf KProcess\-Controller}
\end{CompactItemize}


\subsection{Detailed Description}
Child process invocation, monitoring and control. 

{\bf General usage and features:}\par


This class allows a {\bf KDE}{\rm (p.\,\pageref{namespaceKDE})} application to start child processes without having to worry about UN$\ast$X signal handling issues and zombie process reaping.

\begin{Desc}
\item[See also:]{\bf KProc\-IO}{\rm (p.\,\pageref{classKProcIO})}\end{Desc}
Basically, this class distinguishes three different ways of running child processes:

\begin{itemize}
\item Dont\-Care -- The child process is invoked and both the child process and the parent process continue concurrently.\end{itemize}
The process is started in an own session (see setsid(2)).

\begin{itemize}
\item Notify\-On\-Exit -- The child process is invoked and both the child and the parent process run concurrently.\end{itemize}
When the child process exits, the KProcess instance corresponding to it emits the {\bf Qt} signal {\bf process\-Exited()}{\rm (p.\,\pageref{classKProcess_l0})}. Since this signal is {\em not\/} emitted from within a UN$\ast$X signal handler, arbitrary function calls can be made.

Be aware: When the KProcess object gets destructed, the child process will be killed if it is still running! This means in particular, that it usually makes no sense to use a KProcess on the stack with Notify\-On\-Exit.

\begin{itemize}
\item Own\-Group -- like Notify\-On\-Exit, but the child process is started in an own process group (and an own session, FWIW). The behavior of {\bf kill()}{\rm (p.\,\pageref{classKProcess_a10})} changes to killing the whole process group - this makes this mode useful for implementing primitive job management. It can be used to work around broken wrapper scripts that don't propagate signals to the \char`\"{}real\char`\"{} program. However, use this with care, as you disturb the shell's job management if your program is started from the command line.\end{itemize}
\begin{itemize}
\item Block -- The child process starts and the parent process is suspended until the child process exits. ({\em Really\/} not recommended for programs with a GUI.) In this mode the parent can read the child's output, but can't send it any input.\end{itemize}
KProcess also provides several functions for determining the exit status and the pid of the child process it represents.

Furthermore it is possible to supply command-line arguments to the process in a clean fashion (no null-terminated stringlists and such...)

A small usage example: 

\footnotesize\begin{verbatim}   KProcess *proc = new KProcess;

   *proc << "my_executable";
   *proc << "These" << "are" << "the" << "command" << "line" << "args";
   QApplication::connect(proc, SIGNAL(processExited(KProcess *)),
                         pointer_to_my_object, SLOT(my_objects_slot(KProcess *)));
   proc->start();
\end{verbatim}
\normalsize


This will start \char`\"{}my\_\-executable\char`\"{} with the commandline arguments \char`\"{}These\char`\"{}...

When the child process exits, the slot will be invoked.

{\bf Communication with the child process:}\par


KProcess supports communication with the child process through stdin/stdout/stderr.

The following functions are provided for getting data from the child process or sending data to the child's stdin (For more information, have a look at the documentation of each function):

\begin{itemize}
\item {\bf write\-Stdin()}{\rm (p.\,\pageref{classKProcess_a22})} -- Transmit data to the child process' stdin. When all data was sent, the signal {\bf wrote\-Stdin()}{\rm (p.\,\pageref{classKProcess_l4})} is emitted.\end{itemize}
\begin{itemize}
\item When data arrives at stdout or stderr, the signal {\bf received\-Stdout()}{\rm (p.\,\pageref{classKProcess_l1})} resp. {\bf received\-Stderr()}{\rm (p.\,\pageref{classKProcess_l3})} is emitted.\end{itemize}
\begin{itemize}
\item You can shut down individual communication channels with {\bf close\-Stdin()}{\rm (p.\,\pageref{classKProcess_a23})}, {\bf close\-Stdout()}{\rm (p.\,\pageref{classKProcess_a24})}, and {\bf close\-Stderr()}{\rm (p.\,\pageref{classKProcess_a25})}, resp.\end{itemize}
\begin{Desc}
\item[Author:]Christian Czezatke {\tt e9025461@student.tuwien.ac.at} \end{Desc}




Definition at line 124 of file kprocess.h.

\subsection{Member Enumeration Documentation}
\index{KProcess@{KProcess}!Communication@{Communication}}
\index{Communication@{Communication}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf KProcess::Communication}}\label{classKProcess_w18}


Modes in which the communication channel can be opened. 

If communication for more than one channel is required, the values have to be or'ed together, for example to get communication with stdout as well as with stdin, you would specify {\tt Stdin} $|$ {\tt Stdout} 

If {\tt No\-Read} is specified in conjunction with {\tt Stdout}, no data is actually read from {\tt Stdout} but only the signal {\bf received\-Stdout(int fd, int \&len)}{\rm (p.\,\pageref{classKProcess_l2})} is emitted. 

Definition at line 142 of file kprocess.h.\index{KProcess@{KProcess}!RunMode@{RunMode}}
\index{RunMode@{RunMode}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf KProcess::Run\-Mode}}\label{classKProcess_w19}


Run-modes for a child process. 

\begin{Desc}
\item[Enumeration values: ]\par
\begin{description}
\index{DontCare@{DontCare}!KProcess@{KProcess}}\index{KProcess@{KProcess}!DontCare@{DontCare}}\item[{\em 
Dont\-Care\label{classKProcess_w19w7}
}]The application does not receive notifications from the subprocess when it is finished or aborted. \index{NotifyOnExit@{NotifyOnExit}!KProcess@{KProcess}}\index{KProcess@{KProcess}!NotifyOnExit@{NotifyOnExit}}\item[{\em 
Notify\-On\-Exit\label{classKProcess_w19w8}
}]The application is notified when the subprocess dies. \index{Block@{Block}!KProcess@{KProcess}}\index{KProcess@{KProcess}!Block@{Block}}\item[{\em 
Block\label{classKProcess_w19w9}
}]The application is suspended until the started process is finished. \index{OwnGroup@{OwnGroup}!KProcess@{KProcess}}\index{KProcess@{KProcess}!OwnGroup@{OwnGroup}}\item[{\em 
Own\-Group\label{classKProcess_w19w10}
}]Same as Notify\-On\-Exit, but the process is run in an own session, just like with Dont\-Care. \end{description}
\end{Desc}



Definition at line 152 of file kprocess.h.\subsubsection{\setlength{\rightskip}{0pt plus 5cm}anonymous enum}\label{classKProcess_w20}


More or less intuitive constants for use with {\bf set\-Priority()}{\rm (p.\,\pageref{classKProcess_a35})}. 



Definition at line 552 of file kprocess.h.

\subsection{Constructor \& Destructor Documentation}
\index{KProcess@{KProcess}!KProcess@{KProcess}}
\index{KProcess@{KProcess}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KProcess::KProcess ({\bf QObject} $\ast$ {\em parent}, const char $\ast$ {\em name} = {\tt 0})}\label{classKProcess_a0}


Constructor \begin{Desc}
\item[Since:]3.2. \end{Desc}




Definition at line 120 of file kprocess.cpp.

References KProcess\-Controller::add\-KProcess(), err, in, out, and KProcess\-Controller::ref().\index{KProcess@{KProcess}!KProcess@{KProcess}}
\index{KProcess@{KProcess}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KProcess::KProcess ()}\label{classKProcess_a1}


Constructor. 



Definition at line 145 of file kprocess.cpp.

References KProcess\-Controller::add\-KProcess(), err, in, out, and KProcess\-Controller::ref().\index{KProcess@{KProcess}!~KProcess@{$\sim$KProcess}}
\index{~KProcess@{$\sim$KProcess}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KProcess::$\sim${\bf KProcess} ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKProcess_a2}


Destructor:. 

If the process is running when the destructor for this class is called, the child process is killed with a SIGKILL, but only if the run mode is not of type {\tt Dont\-Care}. Processes started as {\tt Dont\-Care} keep running anyway. 

Definition at line 225 of file kprocess.cpp.

References KProcess\-Controller::deref(), detach(), Dont\-Care, kill(), KProcess\-Controller::remove\-KProcess(), and run\_\-mode.

\subsection{Member Function Documentation}
\index{KProcess@{KProcess}!setExecutable@{setExecutable}}
\index{setExecutable@{setExecutable}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProcess::set\-Executable (const {\bf QString} \& {\em proc})}\label{classKProcess_a3}


\begin{Desc}
\item[{\bf Deprecated}]Use operator$<$$<$ instead. \end{Desc}
Sets the executable to be started with this KProcess object. Returns false if the process is currently running (in that case the executable remains unchanged).

\begin{Desc}
\item[See also:]operator$<$$<$ \end{Desc}


Definition at line 255 of file kprocess.cpp.

References arguments, QValue\-List::begin(), QValue\-List::is\-Empty(), QValue\-List::prepend(), QValue\-List::remove(), and runs.\index{KProcess@{KProcess}!operator<<@{operator$<$$<$}}
\index{operator<<@{operator$<$$<$}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KProcess} \& KProcess::operator$<$$<$ (const {\bf QString} \& {\em arg})}\label{classKProcess_a4}


Sets the executable and the command line argument list for this process. 

For example, doing an \char`\"{}ls -l /usr/local/bin\char`\"{} can be achieved by: 

\footnotesize\begin{verbatim}  KProcess p;
  ...
  p << "ls" << "-l" << "/usr/local/bin"
\end{verbatim}
\normalsize


\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em arg}]the argument to add \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a reference to this KProcess \end{Desc}


Definition at line 287 of file kprocess.cpp.

References QValue\-List::append(), and arguments.

Referenced by operator$<$$<$().\index{KProcess@{KProcess}!operator<<@{operator$<$$<$}}
\index{operator<<@{operator$<$$<$}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KProcess} \& KProcess::operator$<$$<$ (const char $\ast$ {\em arg})}\label{classKProcess_a5}


Similar to previous method, takes a char $\ast$, supposed to be in locale 8 bit already. 



Definition at line 281 of file kprocess.cpp.

References QValue\-List::append(), and arguments.\index{KProcess@{KProcess}!operator<<@{operator$<$$<$}}
\index{operator<<@{operator$<$$<$}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KProcess} \& KProcess::operator$<$$<$ (const {\bf QCString} \& {\em arg})}\label{classKProcess_a6}


Similar to previous method, takes a {\bf QCString}, supposed to be in locale 8 bit already. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em arg}]the argument to add \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a reference to this KProcess \end{Desc}


Definition at line 276 of file kprocess.cpp.

References operator$<$$<$().\index{KProcess@{KProcess}!operator<<@{operator$<$$<$}}
\index{operator<<@{operator$<$$<$}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KProcess} \& KProcess::operator$<$$<$ (const {\bf QString\-List} \& {\em args})}\label{classKProcess_a7}


Sets the executable and the command line argument list for this process, in a single method call, or add a list of arguments. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em args}]the arguments to add \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a reference to this KProcess \end{Desc}


Definition at line 268 of file kprocess.cpp.

References QValue\-List::append(), args(), arguments, QValue\-List::begin(), and QValue\-List::end().\index{KProcess@{KProcess}!clearArguments@{clearArguments}}
\index{clearArguments@{clearArguments}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::clear\-Arguments ()}\label{classKProcess_a8}


Clear a command line argument list that has been set by using operator$<$$<$. 



Definition at line 293 of file kprocess.cpp.

References arguments, and QValue\-List::clear().

Referenced by KProc\-IO::reset\-All().\index{KProcess@{KProcess}!start@{start}}
\index{start@{start}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProcess::start ({\bf Run\-Mode} {\em runmode} = {\tt NotifyOnExit}, {\bf Communication} {\em comm} = {\tt NoCommunication})\hspace{0.3cm}{\tt  [virtual]}}\label{classKProcess_a9}


Starts the process. 

For a detailed description of the various run modes and communication semantics, have a look at the general description of the KProcess class. Note that if you use set\-Use\-Pty( Stdout $|$ Stderr, $<$bool$>$ ), you cannot use Stdout $|$ Stderr here - instead, use Stdout only to receive the mixed output.

The following problems could cause this function to return false:

\begin{itemize}
\item The process is already running. \item The command line argument list is empty. \item The the {\tt comm} parameter is incompatible with the selected pty usage. \item The starting of the process failed (could not fork). \item The executable was not found.\end{itemize}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em runmode}]The Run-mode for the process. \item[{\em comm}]Specifies which communication links should be established to the child process (stdin/stdout/stderr). By default, no communication takes place and the respective communication signals will never get emitted.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true on success, false on error (see above for error conditions) \end{Desc}


Reimplemented in {\bf KShell\-Process} {\rm (p.\,\pageref{classKShellProcess_a2})}.

Definition at line 298 of file kprocess.cpp.

References arguments, Block, comm\-Close(), comm\-Setup\-Done\-C(), comm\-Setup\-Done\-P(), QValue\-List::count(), Dont\-Care, endl(), QApplication::flush\-X(), input\_\-data, Own\-Group, pid\_\-, process\-Exited(), KProcess\-Controller::reschedule\-Check(), run\_\-mode, run\-Privileged(), runs, setup\-Communication(), setup\-Environment(), status, and KProcess\-Controller::unschedule\-Check().

Referenced by KConfig\-Back\-End::check\-Config\-Files\-Writable(), KProc\-IO::start(), and KShell\-Process::start().\index{KProcess@{KProcess}!kill@{kill}}
\index{kill@{kill}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProcess::kill (int {\em signo} = {\tt SIGTERM})\hspace{0.3cm}{\tt  [virtual]}}\label{classKProcess_a10}


Stop the process (by sending it a signal). 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em signo}]The signal to send. The default is SIGTERM. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if the signal was delivered successfully. \end{Desc}


Definition at line 492 of file kprocess.cpp.

References Own\-Group, pid\_\-, run\_\-mode, and runs.

Referenced by KProc\-IO::reset\-All(), and $\sim$KProcess().\index{KProcess@{KProcess}!isRunning@{isRunning}}
\index{isRunning@{isRunning}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProcess::is\-Running () const}\label{classKProcess_a11}


Checks whether the process is running. 

\begin{Desc}
\item[Returns:]true if the process is (still) considered to be running \end{Desc}


Definition at line 503 of file kprocess.cpp.

References runs.

Referenced by KProc\-IO::reset\-All().\index{KProcess@{KProcess}!pid@{pid}}
\index{pid@{pid}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}pid\_\-t KProcess::pid () const}\label{classKProcess_a12}


Returns the process id of the process. 

If it is called after the process has exited, it returns the process id of the last child process that was created by this instance of KProcess.

Calling it before any child process has been started by this KProcess instance causes {\bf pid()}{\rm (p.\,\pageref{classKProcess_a12})} to return 0. \begin{Desc}
\item[Returns:]the pid of the process or 0 if no process has been started yet. \end{Desc}


Definition at line 510 of file kprocess.cpp.

References pid\_\-.\index{KProcess@{KProcess}!getPid@{getPid}}
\index{getPid@{getPid}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KDE\_\-DEPRECATED pid\_\-t KProcess::get\-Pid () const\hspace{0.3cm}{\tt  [inline]}}\label{classKProcess_a13}


\begin{Desc}
\item[{\bf Deprecated}]Use {\bf pid()}{\rm (p.\,\pageref{classKProcess_a12})} instead. \end{Desc}


Definition at line 306 of file kprocess.h.\index{KProcess@{KProcess}!suspend@{suspend}}
\index{suspend@{suspend}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::suspend ()}\label{classKProcess_a14}


Suspend processing of data from stdout of the child process. 



Definition at line 647 of file kprocess.cpp.

References outnot, and QSocket\-Notifier::set\-Enabled().

Referenced by comm\-Setup\-Done\-P().\index{KProcess@{KProcess}!resume@{resume}}
\index{resume@{resume}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::resume ()}\label{classKProcess_a15}


Resume processing of data from stdout of the child process. 



Definition at line 653 of file kprocess.cpp.

References outnot, and QSocket\-Notifier::set\-Enabled().\index{KProcess@{KProcess}!wait@{wait}}
\index{wait@{wait}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProcess::wait (int {\em timeout} = {\tt -1})}\label{classKProcess_a16}


Suspend execution of the current thread until the child process dies or the timeout hits. 

This function is not recommended for programs with a GUI. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em timeout}]timeout in seconds. -1 means wait indefinitely. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if the process exited, false if the timeout hit. \end{Desc}
\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 527 of file kprocess.cpp.

References KProcess\-Controller::notifier\-Fd(), pid\_\-, process\-Has\-Exited(), KProcess\-Controller::reschedule\-Check(), runs, status, and KProcess\-Controller::unschedule\-Check().\index{KProcess@{KProcess}!normalExit@{normalExit}}
\index{normalExit@{normalExit}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProcess::normal\-Exit () const}\label{classKProcess_a17}


Checks whether the process exited cleanly. 

\begin{Desc}
\item[Returns:]true if the process has already finished and has exited \char`\"{}voluntarily\char`\"{}, ie: it has not been killed by a signal. \end{Desc}


Definition at line 593 of file kprocess.cpp.

References pid\_\-, runs, and status.\index{KProcess@{KProcess}!signalled@{signalled}}
\index{signalled@{signalled}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProcess::signalled () const}\label{classKProcess_a18}


Checks whether the process was killed by a signal. 

\begin{Desc}
\item[Returns:]true if the process has already finished and has not exited \char`\"{}voluntarily\char`\"{}, ie: it has been killed by a signal.\end{Desc}
\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 599 of file kprocess.cpp.

References pid\_\-, runs, and status.

Referenced by core\-Dumped().\index{KProcess@{KProcess}!coreDumped@{coreDumped}}
\index{coreDumped@{coreDumped}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProcess::core\-Dumped () const}\label{classKProcess_a19}


Checks whether a killed process dumped core. 

\begin{Desc}
\item[Returns:]true if {\bf signalled()}{\rm (p.\,\pageref{classKProcess_a18})} returns true and the process dumped core. Note that on systems that don't define the WCOREDUMP macro, the return value is always false.\end{Desc}
\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 605 of file kprocess.cpp.

References signalled(), and status.\index{KProcess@{KProcess}!exitStatus@{exitStatus}}
\index{exitStatus@{exitStatus}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KProcess::exit\-Status () const}\label{classKProcess_a20}


Returns the exit status of the process. 

\begin{Desc}
\item[Returns:]the exit status of the process. Note that this value is not valid if {\bf normal\-Exit()}{\rm (p.\,\pageref{classKProcess_a17})} returns false. \end{Desc}


Definition at line 615 of file kprocess.cpp.

References status.\index{KProcess@{KProcess}!exitSignal@{exitSignal}}
\index{exitSignal@{exitSignal}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KProcess::exit\-Signal () const}\label{classKProcess_a21}


Returns the signal the process was killed by. 

\begin{Desc}
\item[Returns:]the signal number that caused the process to exit. Note that this value is not valid if {\bf signalled()}{\rm (p.\,\pageref{classKProcess_a18})} returns false.\end{Desc}
\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 621 of file kprocess.cpp.

References status.\index{KProcess@{KProcess}!writeStdin@{writeStdin}}
\index{writeStdin@{writeStdin}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProcess::write\-Stdin (const char $\ast$ {\em buffer}, int {\em buflen})}\label{classKProcess_a22}


Transmit data to the child process' stdin. 

This function may return false in the following cases:

\begin{itemize}
\item The process is not currently running. This implies that you cannot use this function in Block mode.\end{itemize}
\begin{itemize}
\item Communication to stdin has not been requested in the {\bf start()}{\rm (p.\,\pageref{classKProcess_a9})} call.\end{itemize}
\begin{itemize}
\item Transmission of data to the child process by a previous call to {\bf write\-Stdin()}{\rm (p.\,\pageref{classKProcess_a22})} is still in progress.\end{itemize}
Please note that the data is sent to the client asynchronously, so when this function returns, the data might not have been processed by the child process. That means that you must not free {\tt buffer} or call {\bf write\-Stdin()}{\rm (p.\,\pageref{classKProcess_a22})} again until either a {\bf wrote\-Stdin()}{\rm (p.\,\pageref{classKProcess_l4})} signal indicates that the data has been sent or a {\bf process\-Exited()}{\rm (p.\,\pageref{classKProcess_l0})} signal shows that the child process is no longer alive.

If all the data has been sent to the client, the signal {\bf wrote\-Stdin()}{\rm (p.\,\pageref{classKProcess_l4})} will be emitted.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em buffer}]the buffer to write \item[{\em buflen}]the length of the buffer \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]false if an error has occurred \end{Desc}


Definition at line 627 of file kprocess.cpp.

References communication, innot, input\_\-data, input\_\-sent, input\_\-total, QSocket\-Notifier::set\-Enabled(), and slot\-Send\-Data().

Referenced by KProc\-IO::fputs(), and KProc\-IO::write\-Stdin().\index{KProcess@{KProcess}!closeStdin@{closeStdin}}
\index{closeStdin@{closeStdin}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProcess::close\-Stdin ()}\label{classKProcess_a23}


Shuts down the Stdin communication link. 

If no pty is used, this causes \char`\"{}EOF\char`\"{} to be indicated on the child's stdin file descriptor.

\begin{Desc}
\item[Returns:]false if no Stdin communication link exists (any more). \end{Desc}


Definition at line 659 of file kprocess.cpp.

References communication, in, and innot.

Referenced by close\-All(), KProc\-IO::close\-When\-Done(), comm\-Close(), and slot\-Send\-Data().\index{KProcess@{KProcess}!closeStdout@{closeStdout}}
\index{closeStdout@{closeStdout}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProcess::close\-Stdout ()}\label{classKProcess_a24}


Shuts down the Stdout communication link. 

If no pty is used, any further attempts by the child to write to its stdout file descriptor will cause it to receive a SIGPIPE.

\begin{Desc}
\item[Returns:]false if no Stdout communication link exists (any more). \end{Desc}


Definition at line 673 of file kprocess.cpp.

References communication, out, and outnot.

Referenced by close\-All(), comm\-Close(), and slot\-Child\-Output().\index{KProcess@{KProcess}!closeStderr@{closeStderr}}
\index{closeStderr@{closeStderr}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProcess::close\-Stderr ()}\label{classKProcess_a25}


Shuts down the Stderr communication link. 

If no pty is used, any further attempts by the child to write to its stderr file descriptor will cause it to receive a SIGPIPE.

\begin{Desc}
\item[Returns:]false if no Stderr communication link exists (any more). \end{Desc}


Definition at line 687 of file kprocess.cpp.

References communication, err, and errnot.

Referenced by close\-All(), comm\-Close(), and slot\-Child\-Error().\index{KProcess@{KProcess}!closePty@{closePty}}
\index{closePty@{closePty}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProcess::close\-Pty ()}\label{classKProcess_a26}


Deletes the optional utmp entry and closes the pty. 

Make sure to shut down any communication links that are using the pty before calling this function.

\begin{Desc}
\item[Returns:]false if the pty is not open (any more). \end{Desc}


Definition at line 701 of file kprocess.cpp.

Referenced by close\-All(), and comm\-Close().\index{KProcess@{KProcess}!closeAll@{closeAll}}
\index{closeAll@{closeAll}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::close\-All ()}\label{classKProcess_a27}


Calls the above four close$\ast$ functions in a row. 



Definition at line 716 of file kprocess.cpp.

References close\-Pty(), close\-Stderr(), close\-Stdin(), and close\-Stdout().\index{KProcess@{KProcess}!args@{args}}
\index{args@{args}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf QValue\-List}$<${\bf QCString}$>$\& KProcess::args ()\hspace{0.3cm}{\tt  [inline]}}\label{classKProcess_a28}


Lets you see what your arguments are for debugging. 

\begin{Desc}
\item[Returns:]the list of arguments \end{Desc}


Definition at line 450 of file kprocess.h.

Referenced by operator$<$$<$().\index{KProcess@{KProcess}!setRunPrivileged@{setRunPrivileged}}
\index{setRunPrivileged@{setRunPrivileged}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::set\-Run\-Privileged (bool {\em keep\-Privileges})}\label{classKProcess_a29}


Controls whether the started process should drop any setuid/setgid privileges or whether it should keep them. 

Note that this function is mostly a dummy, as the {\bf KDE}{\rm (p.\,\pageref{namespaceKDE})} libraries currently refuse to run with setuid/setgid privileges.

The default is false: drop privileges \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em keep\-Privileges}]true to keep the privileges \end{description}
\end{Desc}


Definition at line 198 of file kprocess.cpp.

References keep\-Privs.\index{KProcess@{KProcess}!runPrivileged@{runPrivileged}}
\index{runPrivileged@{runPrivileged}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProcess::run\-Privileged () const}\label{classKProcess_a30}


Returns whether the started process will drop any setuid/setgid privileges or whether it will keep them. 

\begin{Desc}
\item[Returns:]true if the process runs privileged \end{Desc}


Definition at line 204 of file kprocess.cpp.

References keep\-Privs.

Referenced by start().\index{KProcess@{KProcess}!setEnvironment@{setEnvironment}}
\index{setEnvironment@{setEnvironment}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::set\-Environment (const {\bf QString} \& {\em name}, const {\bf QString} \& {\em value})}\label{classKProcess_a31}


Adds the variable {\tt name} to the process' environment. 

This function must be called before starting the process. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]the name of the environment variable \item[{\em value}]the new value for the environment variable \end{description}
\end{Desc}


Definition at line 171 of file kprocess.cpp.\index{KProcess@{KProcess}!setWorkingDirectory@{setWorkingDirectory}}
\index{setWorkingDirectory@{setWorkingDirectory}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::set\-Working\-Directory (const {\bf QString} \& {\em dir})}\label{classKProcess_a32}


Changes the current working directory (CWD) of the process to be started. 

This function must be called before starting the process. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dir}]the new directory \end{description}
\end{Desc}


Definition at line 177 of file kprocess.cpp.\index{KProcess@{KProcess}!setUseShell@{setUseShell}}
\index{setUseShell@{setUseShell}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::set\-Use\-Shell (bool {\em use\-Shell}, const char $\ast$ {\em shell} = {\tt 0})}\label{classKProcess_a33}


Specify whether to start the command via a shell or directly. 

The default is to start the command directly. If {\tt use\-Shell} is true {\tt shell} will be used as shell, or if shell is empty, /bin/sh will be used.

When using a shell, the caller should make sure that all filenames etc. are properly quoted when passed as argument. \begin{Desc}
\item[See also:]{\bf quote()}{\rm (p.\,\pageref{classKProcess_e0})} \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em use\-Shell}]true if the command should be started via a shell \item[{\em shell}]the path to the shell that will execute the process, or 0 to use /bin/sh. Use getenv(\char`\"{}SHELL\char`\"{}) to use the user's default shell, but note that doing so is usually a bad idea for shell compatibility reasons. \end{description}
\end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 764 of file kprocess.cpp.

Referenced by KShell\-Process::KShell\-Process().\index{KProcess@{KProcess}!quote@{quote}}
\index{quote@{quote}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KProcess::quote (const {\bf QString} \& {\em arg})\hspace{0.3cm}{\tt  [static]}}\label{classKProcess_e0}


This function can be used to quote an argument string such that the shell processes it properly. 

This is e. g. necessary for user-provided file names which may contain spaces or quotes. It also prevents expansion of wild cards and environment variables. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em arg}]the argument to quote \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the quoted argument \end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Reimplemented in {\bf KShell\-Process} {\rm (p.\,\pageref{classKShellProcess_e0})}.

Definition at line 808 of file kprocess.cpp.

References QString::append(), QString::prepend(), and QString::replace().

Referenced by KShell\-Process::quote(), and KTemp\-Dir::unlink().\index{KProcess@{KProcess}!detach@{detach}}
\index{detach@{detach}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::detach ()}\label{classKProcess_a34}


Detaches KProcess from child process. 

All communication is closed. No exit notification is emitted any more for the child process. Deleting the KProcess will no longer kill the child process. Note that the current process remains the parent process of the child process. 

Definition at line 240 of file kprocess.cpp.

References KProcess\-Controller::add\-Process(), comm\-Close(), pid\_\-, and runs.

Referenced by $\sim$KProcess().\index{KProcess@{KProcess}!setPriority@{setPriority}}
\index{setPriority@{setPriority}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProcess::set\-Priority (int {\em prio})}\label{classKProcess_a35}


Sets the scheduling priority of the process. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em prio}]the new priority in the range -20 (high) to 19 (low). \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]false on error; see setpriority(2) for possible reasons. \end{Desc}
\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 210 of file kprocess.cpp.

References pid\_\-, and runs.\index{KProcess@{KProcess}!processExited@{processExited}}
\index{processExited@{processExited}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::process\-Exited ({\bf KProcess} $\ast$ {\em proc})\hspace{0.3cm}{\tt  [signal]}}\label{classKProcess_l0}


Emitted after the process has terminated when the process was run in the {\tt Notify\-On\-Exit} (==default option to {\bf start()}{\rm (p.\,\pageref{classKProcess_a9})} ) or the Block mode. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em proc}]a pointer to the process that has exited \end{description}
\end{Desc}


Referenced by process\-Has\-Exited(), and start().\index{KProcess@{KProcess}!receivedStdout@{receivedStdout}}
\index{receivedStdout@{receivedStdout}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::received\-Stdout ({\bf KProcess} $\ast$ {\em proc}, char $\ast$ {\em buffer}, int {\em buflen})\hspace{0.3cm}{\tt  [signal]}}\label{classKProcess_l1}


Emitted, when output from the child process has been received on stdout. 

To actually get this signal, the Stdout communication link has to be turned on in {\bf start()}{\rm (p.\,\pageref{classKProcess_a9})}.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em proc}]a pointer to the process that has received the output \item[{\em buffer}]The data received. \item[{\em buflen}]The number of bytes that are available.\end{description}
\end{Desc}
You should copy the information contained in {\tt buffer} to your private data structures before returning from the slot. Example: 

\footnotesize\begin{verbatim}     QString myBuf = QString::fromLatin1(buffer, buflen);
\end{verbatim}
\normalsize
 

Referenced by child\-Output().\index{KProcess@{KProcess}!receivedStdout@{receivedStdout}}
\index{receivedStdout@{receivedStdout}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::received\-Stdout (int {\em fd}, int \& {\em len})\hspace{0.3cm}{\tt  [signal]}}\label{classKProcess_l2}


Emitted when output from the child process has been received on stdout. 

To actually get this signal, the Stdout communication link has to be turned on in {\bf start()}{\rm (p.\,\pageref{classKProcess_a9})} and the No\-Read flag must have been passed.

You will need to explicitly call {\bf resume()}{\rm (p.\,\pageref{classKProcess_a15})} after your call to {\bf start()}{\rm (p.\,\pageref{classKProcess_a9})} to begin processing data from the child process' stdout. This is to ensure that this signal is not emitted when no one is connected to it, otherwise this signal will not be emitted.

The data still has to be read from file descriptor {\tt fd}. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em fd}]the file descriptor that provides the data \item[{\em len}]the number of bytes that have been read from {\tt fd} must be written here \end{description}
\end{Desc}
\index{KProcess@{KProcess}!receivedStderr@{receivedStderr}}
\index{receivedStderr@{receivedStderr}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::received\-Stderr ({\bf KProcess} $\ast$ {\em proc}, char $\ast$ {\em buffer}, int {\em buflen})\hspace{0.3cm}{\tt  [signal]}}\label{classKProcess_l3}


Emitted, when output from the child process has been received on stderr. 

To actually get this signal, the Stderr communication link has to be turned on in {\bf start()}{\rm (p.\,\pageref{classKProcess_a9})}.

You should copy the information contained in {\tt buffer} to your private data structures before returning from the slot.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em proc}]a pointer to the process that has received the data \item[{\em buffer}]The data received. \item[{\em buflen}]The number of bytes that are available. \end{description}
\end{Desc}


Referenced by child\-Error().\index{KProcess@{KProcess}!wroteStdin@{wroteStdin}}
\index{wroteStdin@{wroteStdin}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::wrote\-Stdin ({\bf KProcess} $\ast$ {\em proc})\hspace{0.3cm}{\tt  [signal]}}\label{classKProcess_l4}


Emitted after all the data that has been specified by a prior call to {\bf write\-Stdin()}{\rm (p.\,\pageref{classKProcess_a22})} has actually been written to the child process. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em proc}]a pointer to the process \end{description}
\end{Desc}


Referenced by KProc\-IO::reset\-All(), slot\-Send\-Data(), and KProc\-IO::start().\index{KProcess@{KProcess}!slotChildOutput@{slotChildOutput}}
\index{slotChildOutput@{slotChildOutput}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::slot\-Child\-Output (int {\em fdno})\hspace{0.3cm}{\tt  [protected, slot]}}\label{classKProcess_j0}


This slot gets activated when data from the child's stdout arrives. 

It usually calls {\bf child\-Output()}{\rm (p.\,\pageref{classKProcess_b7})}. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em fdno}]the file descriptor for the output \end{description}
\end{Desc}


Definition at line 730 of file kprocess.cpp.

References child\-Output(), and close\-Stdout().

Referenced by comm\-Close(), and comm\-Setup\-Done\-P().\index{KProcess@{KProcess}!slotChildError@{slotChildError}}
\index{slotChildError@{slotChildError}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::slot\-Child\-Error (int {\em fdno})\hspace{0.3cm}{\tt  [protected, slot]}}\label{classKProcess_j1}


This slot gets activated when data from the child's stderr arrives. 

It usually calls {\bf child\-Error()}{\rm (p.\,\pageref{classKProcess_b8})}. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em fdno}]the file descriptor for the output \end{description}
\end{Desc}


Definition at line 737 of file kprocess.cpp.

References child\-Error(), and close\-Stderr().

Referenced by comm\-Close(), and comm\-Setup\-Done\-P().\index{KProcess@{KProcess}!slotSendData@{slotSendData}}
\index{slotSendData@{slotSendData}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::slot\-Send\-Data (int {\em dummy})\hspace{0.3cm}{\tt  [protected, slot]}}\label{classKProcess_j2}


Called when another bulk of data can be sent to the child's stdin. 

If there is no more data to be sent to stdin currently available, this function must disable the {\bf QSocket\-Notifier} innot. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dummy}]ignore this argument \end{description}
\end{Desc}


Definition at line 744 of file kprocess.cpp.

References close\-Stdin(), endl(), in, innot, input\_\-data, input\_\-sent, input\_\-total, QSocket\-Notifier::set\-Enabled(), and wrote\-Stdin().

Referenced by comm\-Setup\-Done\-P(), and write\-Stdin().\index{KProcess@{KProcess}!setupEnvironment@{setupEnvironment}}
\index{setupEnvironment@{setupEnvironment}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::setup\-Environment ()\hspace{0.3cm}{\tt  [protected]}}\label{classKProcess_b0}


Sets up the environment according to the data passed via {\bf set\-Environment()}{\rm (p.\,\pageref{classKProcess_a31})}. 



Definition at line 183 of file kprocess.cpp.

References QMap::begin(), QFile::encode\-Name(), and QMap::end().

Referenced by start().\index{KProcess@{KProcess}!setupCommunication@{setupCommunication}}
\index{setupCommunication@{setupCommunication}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KProcess::setup\-Communication ({\bf Communication} {\em comm})\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKProcess_b1}


This function is called from {\bf start()}{\rm (p.\,\pageref{classKProcess_a9})} right before a fork() takes place. 

According to the {\tt comm} parameter this function has to initialize the in, out and err data members of KProcess.

This function should return 1 if setting the needed communication channels was successful.

The default implementation is to create UNIX STREAM sockets for the communication, but you could reimplement this function to establish a TCP/IP communication for network communication, for example. 

Definition at line 873 of file kprocess.cpp.

References communication, endl(), err, in, and out.

Referenced by start().\index{KProcess@{KProcess}!commSetupDoneP@{commSetupDoneP}}
\index{commSetupDoneP@{commSetupDoneP}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KProcess::comm\-Setup\-Done\-P ()\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKProcess_b2}


Called right after a (successful) fork() on the parent side. 

This function will usually do some communications cleanup, like closing in[0], out[1] and out[1].

Furthermore, it must also create the QSocket\-Notifiers innot, outnot and errnot and connect their {\bf Qt} signals to the respective KProcess slots.

For a more detailed explanation, it is best to have a look at the default implementation in {\bf kprocess.cpp}{\rm (p.\,\pageref{kprocess_8cpp})}. 

Definition at line 941 of file kprocess.cpp.

References communication, QObject::connect(), err, errnot, in, innot, Notify\-On\-Exit, out, outnot, Own\-Group, run\_\-mode, QSocket\-Notifier::set\-Enabled(), slot\-Child\-Error(), slot\-Child\-Output(), slot\-Send\-Data(), and suspend().

Referenced by start().\index{KProcess@{KProcess}!commSetupDoneC@{commSetupDoneC}}
\index{commSetupDoneC@{commSetupDoneC}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KProcess::comm\-Setup\-Done\-C ()\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKProcess_b3}


Called right after a (successful) fork(), but before an exec() on the child process' side. 

It usually duplicates the in[0], out[1] and err[1] file handles to the respective standard I/O handles. 

Definition at line 986 of file kprocess.cpp.

References communication, err, in, and out.

Referenced by start().\index{KProcess@{KProcess}!processHasExited@{processHasExited}}
\index{processHasExited@{processHasExited}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::process\-Has\-Exited (int {\em state})\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKProcess_b4}


Immediately called after a successfully started process in Notify\-On\-Exit mode has exited. 

This function normally calls {\bf comm\-Close()}{\rm (p.\,\pageref{classKProcess_b5})} and emits the {\bf process\-Exited()}{\rm (p.\,\pageref{classKProcess_l0})} signal. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]the exit code of the process as returned by waitpid() \end{description}
\end{Desc}


Definition at line 820 of file kprocess.cpp.

References comm\-Close(), Dont\-Care, process\-Exited(), run\_\-mode, runs, and status.

Referenced by wait().\index{KProcess@{KProcess}!commClose@{commClose}}
\index{commClose@{commClose}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::comm\-Close ()\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKProcess_b5}


Cleans up the communication links to the child after it has exited. 

This function should act upon the values of {\bf pid()}{\rm (p.\,\pageref{classKProcess_a12})} and runs. See the {\bf kprocess.cpp}{\rm (p.\,\pageref{kprocess_8cpp})} source for details. \begin{itemize}
\item If {\bf pid()}{\rm (p.\,\pageref{classKProcess_a12})} returns zero, the communication links should be closed only. \item if {\bf pid()}{\rm (p.\,\pageref{classKProcess_a12})} returns non-zero and runs is false, all data immediately available from the communication links should be processed before closing them. \item if {\bf pid()}{\rm (p.\,\pageref{classKProcess_a12})} returns non-zero and runs is true, the communication links should be monitored for data until the file handle returned by {\bf KProcess\-Controller::the\-KProcess\-Controller}{\rm (p.\,\pageref{classKProcessController_s0})}-$>$notifier\-Fd() becomes ready for reading - when it triggers, runs should be reset to false, and the function should be immediately left without closing anything.\end{itemize}
The previous semantics of this function are forward-compatible, but should be avoided, as they are prone to race conditions and can cause KProcess (and thus the whole program) to lock up under certain circumstances. At the end the function closes the communication links in any case. Additionally \begin{itemize}
\item if runs is true, the communication links are monitored for data until all of them have returned EOF. Note that if any system function is interrupted (errno == EINTR) the polling loop should be aborted. \item if runs is false, all data immediately available from the communication links is processed. \end{itemize}


Definition at line 1032 of file kprocess.cpp.

References close\-Pty(), close\-Stderr(), close\-Stdin(), close\-Stdout(), communication, err, KProcess\-Controller::notifier\-Fd(), out, pid\_\-, runs, slot\-Child\-Error(), and slot\-Child\-Output().

Referenced by detach(), process\-Has\-Exited(), and start().\index{KProcess@{KProcess}!setBinaryExecutable@{setBinaryExecutable}}
\index{setBinaryExecutable@{setBinaryExecutable}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::set\-Binary\-Executable (const char $\ast$ {\em filename})\hspace{0.3cm}{\tt  [protected]}}\label{classKProcess_b6}


Specify the actual executable that should be started (first argument to execve) Normally the the first argument is the executable but you can override that with this function. 



Definition at line 250 of file kprocess.cpp.\index{KProcess@{KProcess}!childOutput@{childOutput}}
\index{childOutput@{childOutput}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KProcess::child\-Output (int {\em fdno})\hspace{0.3cm}{\tt  [protected]}}\label{classKProcess_b7}


Called by {\bf slot\-Child\-Output()}{\rm (p.\,\pageref{classKProcess_j0})} this function copies data arriving from the child process' stdout to the respective buffer and emits the signal {\bf received\-Stdout()}{\rm (p.\,\pageref{classKProcess_l1})}. 



Definition at line 835 of file kprocess.cpp.

References communication, and received\-Stdout().

Referenced by slot\-Child\-Output().\index{KProcess@{KProcess}!childError@{childError}}
\index{childError@{childError}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KProcess::child\-Error (int {\em fdno})\hspace{0.3cm}{\tt  [protected]}}\label{classKProcess_b8}


Called by {\bf slot\-Child\-Error()}{\rm (p.\,\pageref{classKProcess_j1})} this function copies data arriving from the child process' stderr to the respective buffer and emits the signal {\bf received\-Stderr()}{\rm (p.\,\pageref{classKProcess_l3})}. 



Definition at line 858 of file kprocess.cpp.

References received\-Stderr().

Referenced by slot\-Child\-Error().

\subsection{Friends And Related Function Documentation}
\index{KProcess@{KProcess}!KProcessController@{KProcessController}}
\index{KProcessController@{KProcessController}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}friend class {\bf KProcess\-Controller}\hspace{0.3cm}{\tt  [friend]}}\label{classKProcess_n0}


{\bf KProcess\-Controller}{\rm (p.\,\pageref{classKProcessController})} is a friend of KProcess because it has to have access to various data members. 



Definition at line 864 of file kprocess.h.

\subsection{Member Data Documentation}
\index{KProcess@{KProcess}!arguments@{arguments}}
\index{arguments@{arguments}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QValue\-List}$<${\bf QCString}$>$ {\bf KProcess::arguments}\hspace{0.3cm}{\tt  [protected]}}\label{classKProcess_p0}


The list of the process' command line arguments. 

The first entry in this list is the executable itself. 

Definition at line 675 of file kprocess.h.

Referenced by clear\-Arguments(), operator$<$$<$(), set\-Executable(), and start().\index{KProcess@{KProcess}!run_mode@{run\_\-mode}}
\index{run_mode@{run\_\-mode}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Run\-Mode} {\bf KProcess::run\_\-mode}\hspace{0.3cm}{\tt  [protected]}}\label{classKProcess_p1}


How to run the process (Block, Notify\-On\-Exit, Dont\-Care). 

You should not modify this data member directly from derived classes. 

Definition at line 680 of file kprocess.h.

Referenced by comm\-Setup\-Done\-P(), kill(), process\-Has\-Exited(), start(), and $\sim$KProcess().\index{KProcess@{KProcess}!runs@{runs}}
\index{runs@{runs}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool {\bf KProcess::runs}\hspace{0.3cm}{\tt  [protected]}}\label{classKProcess_p2}


true if the process is currently running. 

You should not modify this data member directly from derived classes. Please use {\bf is\-Running()}{\rm (p.\,\pageref{classKProcess_a11})} for reading the value of this data member since it will probably be made private in later versions of KProcess. 

Definition at line 687 of file kprocess.h.

Referenced by comm\-Close(), detach(), is\-Running(), kill(), normal\-Exit(), process\-Has\-Exited(), set\-Executable(), set\-Priority(), signalled(), start(), and wait().\index{KProcess@{KProcess}!pid_@{pid\_\-}}
\index{pid_@{pid\_\-}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}pid\_\-t {\bf KProcess::pid\_\-}\hspace{0.3cm}{\tt  [protected]}}\label{classKProcess_p3}


The PID of the currently running process. 

You should not modify this data member in derived classes. Please use {\bf pid()}{\rm (p.\,\pageref{classKProcess_a12})} instead of directly accessing this member since it will probably be made private in later versions of KProcess. 

Definition at line 696 of file kprocess.h.

Referenced by comm\-Close(), detach(), kill(), normal\-Exit(), pid(), set\-Priority(), signalled(), start(), and wait().\index{KProcess@{KProcess}!status@{status}}
\index{status@{status}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf KProcess::status}\hspace{0.3cm}{\tt  [protected]}}\label{classKProcess_p4}


The process' exit status as returned by waitpid(). 

You should not modify the value of this data member from derived classes. You should rather use {\bf exit\-Status()}{\rm (p.\,\pageref{classKProcess_a20})} than accessing this data member directly since it will probably be made private in further versions of KProcess. 

Definition at line 705 of file kprocess.h.

Referenced by core\-Dumped(), exit\-Signal(), exit\-Status(), normal\-Exit(), process\-Has\-Exited(), signalled(), start(), and wait().\index{KProcess@{KProcess}!keepPrivs@{keepPrivs}}
\index{keepPrivs@{keepPrivs}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool {\bf KProcess::keep\-Privs}\hspace{0.3cm}{\tt  [protected]}}\label{classKProcess_p5}


If false, the child process' effective uid \& gid will be reset to the real values. 

\begin{Desc}
\item[See also:]{\bf set\-Run\-Privileged()}{\rm (p.\,\pageref{classKProcess_a29})} \end{Desc}


Definition at line 713 of file kprocess.h.

Referenced by run\-Privileged(), and set\-Run\-Privileged().\index{KProcess@{KProcess}!out@{out}}
\index{out@{out}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf KProcess::out}[2]\hspace{0.3cm}{\tt  [protected]}}\label{classKProcess_p6}


The socket descriptors for stdout. 



Definition at line 804 of file kprocess.h.

Referenced by close\-Stdout(), comm\-Close(), comm\-Setup\-Done\-C(), comm\-Setup\-Done\-P(), KProcess(), and setup\-Communication().\index{KProcess@{KProcess}!in@{in}}
\index{in@{in}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf KProcess::in}[2]\hspace{0.3cm}{\tt  [protected]}}\label{classKProcess_p7}


The socket descriptors for stdin. 



Definition at line 808 of file kprocess.h.

Referenced by close\-Stdin(), comm\-Setup\-Done\-C(), comm\-Setup\-Done\-P(), KProcess(), setup\-Communication(), and slot\-Send\-Data().\index{KProcess@{KProcess}!err@{err}}
\index{err@{err}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf KProcess::err}[2]\hspace{0.3cm}{\tt  [protected]}}\label{classKProcess_p8}


The socket descriptors for stderr. 



Definition at line 812 of file kprocess.h.

Referenced by close\-Stderr(), comm\-Close(), comm\-Setup\-Done\-C(), comm\-Setup\-Done\-P(), KProcess(), and setup\-Communication().\index{KProcess@{KProcess}!innot@{innot}}
\index{innot@{innot}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QSocket\-Notifier}$\ast$ {\bf KProcess::innot}\hspace{0.3cm}{\tt  [protected]}}\label{classKProcess_p9}


The socket notifier for in[1]. 



Definition at line 817 of file kprocess.h.

Referenced by close\-Stdin(), comm\-Setup\-Done\-P(), slot\-Send\-Data(), and write\-Stdin().\index{KProcess@{KProcess}!outnot@{outnot}}
\index{outnot@{outnot}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QSocket\-Notifier}$\ast$ {\bf KProcess::outnot}\hspace{0.3cm}{\tt  [protected]}}\label{classKProcess_p10}


The socket notifier for out[0]. 



Definition at line 821 of file kprocess.h.

Referenced by close\-Stdout(), comm\-Setup\-Done\-P(), resume(), and suspend().\index{KProcess@{KProcess}!errnot@{errnot}}
\index{errnot@{errnot}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QSocket\-Notifier}$\ast$ {\bf KProcess::errnot}\hspace{0.3cm}{\tt  [protected]}}\label{classKProcess_p11}


The socket notifier for err[0]. 



Definition at line 825 of file kprocess.h.

Referenced by close\-Stderr(), and comm\-Setup\-Done\-P().\index{KProcess@{KProcess}!communication@{communication}}
\index{communication@{communication}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Communication} {\bf KProcess::communication}\hspace{0.3cm}{\tt  [protected]}}\label{classKProcess_p12}


Lists the communication links that are activated for the child process. 

Should not be modified from derived classes. 

Definition at line 831 of file kprocess.h.

Referenced by child\-Output(), close\-Stderr(), close\-Stdin(), close\-Stdout(), comm\-Close(), comm\-Setup\-Done\-C(), comm\-Setup\-Done\-P(), setup\-Communication(), and write\-Stdin().\index{KProcess@{KProcess}!input_data@{input\_\-data}}
\index{input_data@{input\_\-data}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ {\bf KProcess::input\_\-data}\hspace{0.3cm}{\tt  [protected]}}\label{classKProcess_p13}


The buffer holding the data that has to be sent to the child. 



Definition at line 850 of file kprocess.h.

Referenced by slot\-Send\-Data(), start(), and write\-Stdin().\index{KProcess@{KProcess}!input_sent@{input\_\-sent}}
\index{input_sent@{input\_\-sent}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf KProcess::input\_\-sent}\hspace{0.3cm}{\tt  [protected]}}\label{classKProcess_p14}


The number of bytes already transmitted. 



Definition at line 854 of file kprocess.h.

Referenced by slot\-Send\-Data(), and write\-Stdin().\index{KProcess@{KProcess}!input_total@{input\_\-total}}
\index{input_total@{input\_\-total}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf KProcess::input\_\-total}\hspace{0.3cm}{\tt  [protected]}}\label{classKProcess_p15}


The total length of input\_\-data. 



Definition at line 858 of file kprocess.h.

Referenced by slot\-Send\-Data(), and write\-Stdin().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kprocess.h\item 
kprocess.cpp\end{CompactItemize}
