\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=93pt]{classKProcess__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KProcess:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=172pt]{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}
 \}
\begin{CompactList}\small\item\em Modes in which the communication channel can be opened. \item\end{CompactList}\item 
enum {\bf Run\-Mode} \{ {\bf Dont\-Care}, 
{\bf Notify\-On\-Exit}, 
{\bf Block}
 \}
\begin{CompactList}\small\item\em Run-modes for a child process. \item\end{CompactList}\end{CompactItemize}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf process\-Exited} ({\bf KProcess} $\ast$proc)
\begin{CompactList}\small\item\em 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_a8})}()) or the {\bf Block}{\rm (p.\,\pageref{classKProcess_w11w9})} mode. \item\end{CompactList}\item 
void {\bf received\-Stdout} ({\bf KProcess} $\ast$proc, char $\ast$buffer, int buflen)
\begin{CompactList}\small\item\em Emitted, when output from the child process has been received on stdout. \item\end{CompactList}\item 
void {\bf received\-Stdout} (int fd, int \&len)
\begin{CompactList}\small\item\em Emitted when output from the child process has been received on stdout. \item\end{CompactList}\item 
void {\bf received\-Stderr} ({\bf KProcess} $\ast$proc, char $\ast$buffer, int buflen)
\begin{CompactList}\small\item\em Emitted, when output from the child process has been received on stderr. \item\end{CompactList}\item 
void {\bf wrote\-Stdin} ({\bf KProcess} $\ast$proc)
\begin{CompactList}\small\item\em Emitted after all the data that has been specified by a prior call to {\bf write\-Stdin}{\rm (p.\,\pageref{classKProcess_a17})}() has actually been written to the child process. \item\end{CompactList}\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KProcess} ()
\begin{CompactList}\small\item\em Constructor. \item\end{CompactList}\item 
virtual {\bf $\sim$KProcess} ()
\begin{CompactList}\small\item\em Destructor:. \item\end{CompactList}\item 
bool {\bf set\-Executable} (const  {\bf QString} \&proc)
\begin{CompactList}\small\item\em {\bf This class or method is obsolete, it is provided for compatibility only.} \item\end{CompactList}\item 
{\bf KProcess} \& {\bf operator$<$$<$} (const  {\bf QString} \&arg)
\begin{CompactList}\small\item\em Sets the executable and the command line argument list for this process. \item\end{CompactList}\item 
{\bf KProcess} \& {\bf operator$<$$<$} (const  char $\ast$arg)
\begin{CompactList}\small\item\em Similar to previous method, takes a char $\ast$, supposed to be in locale 8 bit already. \item\end{CompactList}\item 
{\bf KProcess} \& {\bf operator$<$$<$} (const  {\bf QCString} \&arg)
\begin{CompactList}\small\item\em Similar to previous method, takes a {\bf QCString}, supposed to be in locale 8 bit already. \item\end{CompactList}\item 
{\bf KProcess} \& {\bf operator$<$$<$} (const  {\bf QString\-List} \&args)
\begin{CompactList}\small\item\em Sets the executable and the command line argument list for this process, in a single method call, or add a list of arguments. \item\end{CompactList}\item 
void {\bf clear\-Arguments} ()
\begin{CompactList}\small\item\em Clear a command line argument list that has been set by using the \char`\"{}operator$<$$<$\char`\"{}. \item\end{CompactList}\item 
virtual bool {\bf start} ({\bf Run\-Mode} runmode=Notify\-On\-Exit, {\bf Communication} comm=No\-Communication)
\begin{CompactList}\small\item\em Starts the process. \item\end{CompactList}\item 
virtual bool {\bf kill} (int signo=SIGTERM)
\begin{CompactList}\small\item\em Stop the process (by sending it a signal). \item\end{CompactList}\item 
bool {\bf is\-Running} () const 
\begin{CompactList}\small\item\em Checks whether the process is running. \item\end{CompactList}\item 
pid\_\-t {\bf pid} () const 
\begin{CompactList}\small\item\em Returns the process id of the process. \item\end{CompactList}\item 
pid\_\-t {\bf get\-Pid} () const 
\begin{CompactList}\small\item\em Use {\bf pid()}{\rm (p.\,\pageref{classKProcess_a11})}. \item\end{CompactList}\item 
void {\bf suspend} ()
\begin{CompactList}\small\item\em Suspend processing of data from stdout of the child process. \item\end{CompactList}\item 
void {\bf resume} ()
\begin{CompactList}\small\item\em Resume processing of data from stdout of the child process. \item\end{CompactList}\item 
bool {\bf normal\-Exit} () const 
\item 
int {\bf exit\-Status} () const 
\begin{CompactList}\small\item\em Returns the exit status of the process. \item\end{CompactList}\item 
bool {\bf write\-Stdin} (const  char $\ast$buffer, int buflen)
\begin{CompactList}\small\item\em Transmit data to the child process's stdin. \item\end{CompactList}\item 
bool {\bf close\-Stdin} ()
\begin{CompactList}\small\item\em This causes the stdin file descriptor of the child process to be closed indicating an \char`\"{}EOF\char`\"{} to the child. \item\end{CompactList}\item 
bool {\bf close\-Stdout} ()
\begin{CompactList}\small\item\em This causes the stdout file descriptor of the child process to be closed. \item\end{CompactList}\item 
bool {\bf close\-Stderr} ()
\begin{CompactList}\small\item\em This causes the stderr file descriptor of the child process to be closed. \item\end{CompactList}\item 
const  {\bf QValue\-List}$<$ {\bf QCString} $>$ \& {\bf args} ()
\begin{CompactList}\small\item\em Lets you see what your arguments are for debugging. \item\end{CompactList}\item 
void {\bf set\-Run\-Privileged} (bool keep\-Privileges)
\begin{CompactList}\small\item\em Controls whether the started process should drop any setuid/segid privileges or whether it should keep them. \item\end{CompactList}\item 
bool {\bf run\-Privileged} () const 
\begin{CompactList}\small\item\em Returns whether the started process will drop any setuid/segid privileges or whether it will keep them. \item\end{CompactList}\item 
void {\bf set\-Environment} (const  {\bf QString} \&{\bf name}, const  {\bf QString} \&value)
\begin{CompactList}\small\item\em Modifies the environment of the process to be started. \item\end{CompactList}\item 
void {\bf set\-Working\-Directory} (const  {\bf QString} \&dir)
\begin{CompactList}\small\item\em Changes the current working directory (CWD) of the process to be started. \item\end{CompactList}\item 
void {\bf set\-Use\-Shell} (bool use\-Shell, const  char $\ast$shell=0)
\begin{CompactList}\small\item\em Specify whether to start the command via a shell or directly. \item\end{CompactList}\item 
void {\bf detach} ()
\begin{CompactList}\small\item\em Detaches KProcess from child process. \item\end{CompactList}\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
{\bf QString} {\bf quote} (const  {\bf QString} \&arg)
\begin{CompactList}\small\item\em This function can be used to quote an argument string such that the shell processes it properly. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Slots}
\begin{CompactItemize}
\item 
void {\bf slot\-Child\-Output} (int fdno)
\begin{CompactList}\small\item\em This slot gets activated when data from the child's stdout arrives. \item\end{CompactList}\item 
void {\bf slot\-Child\-Error} (int fdno)
\begin{CompactList}\small\item\em This slot gets activated when data from the child's stderr arrives. \item\end{CompactList}\item 
void {\bf slot\-Send\-Data} (int dummy)
\begin{CompactList}\small\item\em Called when another bulk of data can be sent to the child's stdin. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
void {\bf setup\-Environment} ()
\begin{CompactList}\small\item\em Sets up the environment according to the data passed via set\-Environment(...). \item\end{CompactList}\item 
virtual int {\bf setup\-Communication} ({\bf Communication} comm)
\begin{CompactList}\small\item\em This function is called from \char`\"{}KProcess::start\char`\"{} right before a \char`\"{}fork\char`\"{} takes place. \item\end{CompactList}\item 
virtual int {\bf comm\-Setup\-Done\-P} ()
\begin{CompactList}\small\item\em Called right after a (successful) fork on the parent side. \item\end{CompactList}\item 
virtual int {\bf comm\-Setup\-Done\-C} ()
\begin{CompactList}\small\item\em Called right after a (successful) fork, but before an \char`\"{}exec\char`\"{} on the child process' side. \item\end{CompactList}\item 
virtual void {\bf process\-Has\-Exited} (int state)
\begin{CompactList}\small\item\em Immediately called after a process has exited. \item\end{CompactList}\item 
virtual void {\bf comm\-Close} ()
\begin{CompactList}\small\item\em Should clean up the communication links to the child after it has exited. \item\end{CompactList}\item 
int {\bf child\-Output} (int fdno)
\begin{CompactList}\small\item\em Called by \char`\"{}slot\-Child\-Output\char`\"{} this function copies data arriving from the child process's stdout to the respective buffer and emits the signal \char`\"{}@ref received\-Stderr\char`\"{}. \item\end{CompactList}\item 
int {\bf child\-Error} (int fdno)
\begin{CompactList}\small\item\em Called by \char`\"{}slot\-Child\-Output\char`\"{} this function copies data arriving from the child process's stdout to the respective buffer and emits the signal \char`\"{}@ref received\-Stderr\char`\"{}. \item\end{CompactList}\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKProcess_b8}

\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
{\bf QValue\-List}$<$ {\bf QCString} $>$ {\bf arguments}
\begin{CompactList}\small\item\em The list of the process' command line arguments. \item\end{CompactList}\item 
{\bf Run\-Mode} {\bf run\_\-mode}
\begin{CompactList}\small\item\em How to run the process (Block, Notify\-On\-Exit, Dont\-Care). \item\end{CompactList}\item 
bool {\bf runs}
\begin{CompactList}\small\item\em true if the process is currently running. \item\end{CompactList}\item 
pid\_\-t {\bf pid\_\-}
\begin{CompactList}\small\item\em The PID of the currently running process (see \char`\"{}get\-Pid()\char`\"{}). \item\end{CompactList}\item 
int {\bf status}
\begin{CompactList}\small\item\em The process' exit status as returned by \char`\"{}waitpid\char`\"{}. \item\end{CompactList}\item 
bool {\bf keep\-Privs}
\begin{CompactList}\small\item\em See {\bf set\-Run\-Privileged()}{\rm (p.\,\pageref{classKProcess_a22})}. \item\end{CompactList}\item 
int {\bf out} [2]
\begin{CompactList}\small\item\em the socket descriptors for stdin/stdout/stderr. \item\end{CompactList}\item 
int {\bf in} [2]\label{classKProcess_p7}

\item 
int {\bf err} [2]\label{classKProcess_p8}

\item 
{\bf QSocket\-Notifier} $\ast$ {\bf innot}
\begin{CompactList}\small\item\em The socket notifiers for the above socket descriptors. \item\end{CompactList}\item 
{\bf QSocket\-Notifier} $\ast$ {\bf outnot}\label{classKProcess_p10}

\item 
{\bf QSocket\-Notifier} $\ast$ {\bf errnot}\label{classKProcess_p11}

\item 
{\bf Communication} {\bf communication}
\begin{CompactList}\small\item\em Lists the communication links that are activated for the child process. \item\end{CompactList}\item 
const  char $\ast$ {\bf input\_\-data}\label{classKProcess_p13}

\item 
int {\bf input\_\-sent}\label{classKProcess_p14}

\item 
int {\bf input\_\-total}\label{classKProcess_p15}

\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf KProcess\-Controller}
\begin{CompactList}\small\item\em {\bf KProcess\-Controller}{\rm (p.\,\pageref{classKProcessController})} is a friend of KProcess because it has to have access to various data members. \item\end{CompactList}\end{CompactItemize}


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

{\bf  General usage and features}

{\bf 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.}

{\bf \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:}

{\bf \begin{itemize}
\item {\bf KProcess::Dont\-Care}{\rm (p.\,\pageref{classKProcess_w11w7})} -- The child process is invoked and both the child process and the parent process continue concurrently.\end{itemize}
Starting a Dont\-Care child process means that the application is not interested in any notification to determine whether the child process has already exited or not.}

{\bf \begin{itemize}
\item {\bf KProcess::Notify\-On\-Exit}{\rm (p.\,\pageref{classKProcess_w11w8})} -- 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})}().}

{\bf Since this signal is {\em not\/} emitted from within a UN$\ast$X signal handler, arbitrary function calls can be made.}

{\bf Be aware: When the KProcess objects gets destructed, the child process will be killed if it is still running! This means in particular, that you cannot use a KProcess on the stack with {\bf KProcess::Notify\-On\-Exit}{\rm (p.\,\pageref{classKProcess_w11w8})}.}

{\bf \begin{itemize}
\item {\bf KProcess::Block}{\rm (p.\,\pageref{classKProcess_w11w9})} -- The child process starts and the parent process is suspended until the child process exits. ({\em Really\/} not recommended for programs with a GUI.)\end{itemize}
KProcess also provides several functions for determining the exit status and the pid of the child process it represents.}

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

{\bf A small usage example: \small\begin{alltt}
 *KProcess *proc = new KProcess;\end{alltt}\normalsize 
}

{\bf \small\begin{alltt} **proc $<$$<$ "my\_executable";
 **proc $<$$<$ "These" $<$$<$ "are" $<$$<$ "the" $<$$<$ "command" $<$$<$ "line" $<$$<$ "args";
 *QApplication::connect(proc, SIGNAL({\bf processExited(KProcess *)}{\rm (p.\,\pageref{classKProcess_l0})}),
                      pointer\_to\_my\_object, SLOT(my\_objects\_slot(KProcess *)));
 *proc-$>${\bf start()}{\rm (p.\,\pageref{classKProcess_a8})};
 *\end{alltt}\normalsize 
}

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

{\bf When the child process exits, the respective {\bf Qt} signal will be emitted.}

{\bf }

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

{\bf {\bf KProcess supports communication with the child process through stdin/stdout/stderr.}}

{\bf {\bf 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):}}

{\bf {\bf \begin{itemize}
\item bool {\bf write\-Stdin}{\rm (p.\,\pageref{classKProcess_a17})}(char $\ast$buffer, int buflen); \item -- Transmit data to the child process's stdin.\end{itemize}
\begin{itemize}
\item bool {\bf close\-Stdin}{\rm (p.\,\pageref{classKProcess_a18})}(); \item -- Closes the child process's stdin (which causes it to see an feof(stdin)). Returns false if you try to close stdin for a process that has been started without a communication channel to stdin.\end{itemize}
\begin{itemize}
\item bool {\bf close\-Stdout}{\rm (p.\,\pageref{classKProcess_a19})}(); \item -- Closes the child process's stdout. Returns false if you try to close stdout for a process that has been started without a communication channel to stdout.\end{itemize}
\begin{itemize}
\item bool {\bf close\-Stderr}{\rm (p.\,\pageref{classKProcess_a20})}(); \item -- Closes the child process's stderr. Returns false if you try to close stderr for a process that has been started without a communication channel to stderr.\end{itemize}
}}

{\bf {\bf {\bf  QT signals:}}}

{\bf {\bf {\bf \begin{itemize}
\item void {\bf received\-Stdout}{\rm (p.\,\pageref{classKProcess_l1})}(KProcess $\ast$proc, char $\ast$buffer, int buflen); \item void {\bf received\-Stderr}{\rm (p.\,\pageref{classKProcess_l3})}(KProcess $\ast$proc, char $\ast$buffer, int buflen); \item -- Indicates that new data has arrived from either the child process's stdout or stderr.\end{itemize}
\begin{itemize}
\item void {\bf wrote\-Stdin}{\rm (p.\,\pageref{classKProcess_l4})}(KProcess $\ast$proc); \item -- Indicates that all data that has been sent to the child process by a prior call to {\bf write\-Stdin}{\rm (p.\,\pageref{classKProcess_a17})}() has actually been transmitted to the client .\end{itemize}
\begin{Desc}
\item[Author:]Christian Czezakte {\tt e9025461@student.tuwien.ac.at} \end{Desc}
}}}



Definition at line 146 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_w10}


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 child\-Output}{\rm (p.\,\pageref{classKProcess_b6})}(int fd) is emitted. 

Definition at line 164 of file kprocess.h.

Referenced by close\-Stdin(), close\-Stdout(), comm\-Close(), and setup\-Communication().\index{KProcess@{KProcess}!RunMode@{RunMode}}
\index{RunMode@{RunMode}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf KProcess::Run\-Mode}}\label{classKProcess_w11}


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_w11w7}
}]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_w11w8}
}]The application is notified when the subprocess dies. \index{Block@{Block}!KProcess@{KProcess}}\index{KProcess@{KProcess}!Block@{Block}}\item[{\em 
Block\label{classKProcess_w11w9}
}]The application is suspended until the started process is finished. \end{description}
\end{Desc}



Definition at line 171 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 ()}\label{classKProcess_a0}


Constructor. 



Definition at line 89 of file kprocess.cpp.

References KProcess\-Controller::add\-KProcess(), KProcess\-Controller, out, and KProcess\-Controller::the\-KProcess\-Controller.\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_a1}


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 159 of file kprocess.cpp.

References close\-Stderr(), close\-Stdin(), close\-Stdout(), Dont\-Care, kill(), KProcess\-Controller::remove\-KProcess(), run\_\-mode, runs, and KProcess\-Controller::the\-KProcess\-Controller.

\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_a2}


{\bf This class or method is obsolete, it is provided for compatibility only.} 

The use of this function is now deprecated. -- Please use the \char`\"{}operator$<$$<$\char`\"{} instead of \char`\"{}set\-Executable\char`\"{}.

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 195 of file kprocess.cpp.

References arguments, QValue\-List$<$ QCString $>$::begin(), QFile::encode\-Name(), QValue\-List$<$ QCString $>$::is\-Empty(), QString::is\-Empty(), QValue\-List$<$ QCString $>$::prepend(), QValue\-List$<$ QCString $>$::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_a3}


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: \small\begin{alltt}
  KProcess p;
  ...
  p $<$$<$ "ls" $<$$<$ "-l" $<$$<$ "/usr/local/bin"
  \end{alltt}\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 227 of file kprocess.cpp.

References QValue\-List$<$ QCString $>$::append(), arguments, and QFile::encode\-Name().

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_a4}


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



Definition at line 221 of file kprocess.cpp.

References QValue\-List$<$ QCString $>$::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_a5}


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 216 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_a6}


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 arg}]the arguments to add \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a reference to this KProcess \end{Desc}


Definition at line 208 of file kprocess.cpp.

References QValue\-List$<$ QCString $>$::append(), arguments, and QFile::encode\-Name().\index{KProcess@{KProcess}!clearArguments@{clearArguments}}
\index{clearArguments@{clearArguments}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::clear\-Arguments ()}\label{classKProcess_a7}


Clear a command line argument list that has been set by using the \char`\"{}operator$<$$<$\char`\"{}. 



Definition at line 233 of file kprocess.cpp.

References arguments, and QValue\-List$<$ QCString $>$::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} = Notify\-On\-Exit, {\bf Communication} {\em comm} = No\-Communication)\hspace{0.3cm}{\tt  [virtual]}}\label{classKProcess_a8}


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.

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 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 238 of file kprocess.cpp.

References arguments, Block, KStd\-Action::close(), comm\-Close(), comm\-Setup\-Done\-C(), comm\-Setup\-Done\-P(), QValue\-List$<$ QCString $>$::count(), Dont\-Care, QApplication::flush\-X(), pid\_\-, process\-Exited(), run\_\-mode, run\-Privileged(), runs, setup\-Communication(), setup\-Environment(), status, and KProcess\-Controller::the\-KProcess\-Controller.

Referenced by 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} = SIGTERM)\hspace{0.3cm}{\tt  [virtual]}}\label{classKProcess_a9}


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 406 of file kprocess.cpp.

References pid\_\-.

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_a10}


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 418 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_a11}


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_a11})} 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 425 of file kprocess.cpp.

References pid\_\-.

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


Use {\bf pid()}{\rm (p.\,\pageref{classKProcess_a11})}. 

{\bf This class or method is obsolete, it is provided for compatibility only.} 

Definition at line 312 of file kprocess.h.

References pid().\index{KProcess@{KProcess}!suspend@{suspend}}
\index{suspend@{suspend}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProcess::suspend ()}\label{classKProcess_a13}


Suspend processing of data from stdout of the child process. 



Definition at line 471 of file kprocess.cpp.

References communication, 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_a14}


Resume processing of data from stdout of the child process. 



Definition at line 477 of file kprocess.cpp.

References communication, and QSocket\-Notifier::set\-Enabled().\index{KProcess@{KProcess}!normalExit@{normalExit}}
\index{normalExit@{normalExit}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProcess::normal\-Exit () const}\label{classKProcess_a15}


\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}
Note that you should check {\bf KProcess::exit\-Status}{\rm (p.\,\pageref{classKProcess_a16})}() to determine whether the process completed its task successful or not. 

Definition at line 432 of file kprocess.cpp.

References pid\_\-, runs, 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_a16}


Returns the exit status of the process. 

Please use {\bf KProcess::normal\-Exit}{\rm (p.\,\pageref{classKProcess_a15})}() to check whether the process has exited cleanly (i.e., {\bf KProcess::normal\-Exit}{\rm (p.\,\pageref{classKProcess_a15})}() returns true) before calling this function because if the process did not exit normally, it does not have a valid exit status. \begin{Desc}
\item[Returns:]the exit status of the process \end{Desc}


Definition at line 440 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_a17}


Transmit data to the child process's stdin. 

{\bf KProcess::write\-Stdin}{\rm (p.\,\pageref{classKProcess_a17})} may return false in the following cases:

\begin{itemize}
\item The process is not currently running.\end{itemize}
\begin{itemize}
\item Communication to stdin has not been requested in the {\bf start}{\rm (p.\,\pageref{classKProcess_a8})}() 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_a17})}() 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.

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

Please note that you must not free \char`\"{}buffer\char`\"{} or call {\bf write\-Stdin}{\rm (p.\,\pageref{classKProcess_a17})}() again until either a {\bf wrote\-Stdin}{\rm (p.\,\pageref{classKProcess_l4})}() signal indicates that the data has been sent or a {\bf process\-Has\-Exited}{\rm (p.\,\pageref{classKProcess_b4})}() signal shows that the child process is no longer alive... \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em buffer}]the buffer to write. Do not free or modify it until you got a {\bf wrote\-Stdin}{\rm (p.\,\pageref{classKProcess_l4})}() or {\bf process\-Has\-Exited}{\rm (p.\,\pageref{classKProcess_b4})}() signal \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]false if an error has occurred \end{Desc}


Definition at line 448 of file kprocess.cpp.

References communication, innot, runs, QSocket\-Notifier::set\-Enabled(), and slot\-Send\-Data().

Referenced by 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_a18}


This causes the stdin file descriptor of the child process to be closed indicating an \char`\"{}EOF\char`\"{} to the child. 

\begin{Desc}
\item[Returns:]false if no communication to the process's stdin had been specified in the call to {\bf start}{\rm (p.\,\pageref{classKProcess_a8})}(). \end{Desc}


Definition at line 483 of file kprocess.cpp.

References KStd\-Action::close(), Communication, communication, and innot.

Referenced by KProc\-IO::close\-When\-Done(), detach(), and $\sim$KProcess().\index{KProcess@{KProcess}!closeStdout@{closeStdout}}
\index{closeStdout@{closeStdout}!KProcess@{KProcess}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProcess::close\-Stdout ()}\label{classKProcess_a19}


This causes the stdout file descriptor of the child process to be closed. 

\begin{Desc}
\item[Returns:]false if no communication to the process's stdout had been specified in the call to {\bf start}{\rm (p.\,\pageref{classKProcess_a8})}(). \end{Desc}


Definition at line 498 of file kprocess.cpp.

References KStd\-Action::close(), Communication, communication, and out.

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


This causes the stderr file descriptor of the child process to be closed. 

\begin{Desc}
\item[Returns:]false if no communication to the process's stderr had been specified in the call to {\bf start}{\rm (p.\,\pageref{classKProcess_a8})}(). \end{Desc}


Definition at line 513 of file kprocess.cpp.

References KStd\-Action::close(), and communication.

Referenced by detach(), slot\-Child\-Error(), and $\sim$KProcess().\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_a21}


Lets you see what your arguments are for debugging. 

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


Definition at line 406 of file kprocess.h.

References arguments.\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_a22}


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

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


Definition at line 147 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_a23}


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

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


Definition at line 153 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_a24}


Modifies the environment of the process to be started. 

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 117 of file kprocess.cpp.

References KStd\-Action::name().\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_a25}


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 125 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} = 0)}\label{classKProcess_a26}


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, the standard shell is used. {\tt quote} A flag indicating whether to quote the arguments.

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 the standard shell \end{description}
\end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 844 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 quite \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 854 of file kprocess.cpp.

References QString::append(), QString::from\-Latin1(), QString::prepend(), and QString::replace().

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


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 182 of file kprocess.cpp.

References close\-Stderr(), close\-Stdin(), close\-Stdout(), pid\_\-, KProcess\-Controller::remove\-KProcess(), runs, and KProcess\-Controller::the\-KProcess\-Controller.\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_a8})}()) or the {\bf Block}{\rm (p.\,\pageref{classKProcess_w11w9})} 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 these signals, the respective communication link (stdout/stderr) has to be turned on in {\bf start}{\rm (p.\,\pageref{classKProcess_a8})}().

\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 this slot. Example: {\bf QString} my\-Buf = QString::from\-Latin1(buffer, buflen); 

Referenced by child\-Output(), KProc\-IO::reset\-All(), and KProc\-IO::start().\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 these signals, the respective communications link (stdout/stderr) has to be turned on in {\bf start}{\rm (p.\,\pageref{classKProcess_a8})}() and the {\tt No\-Read} flag should have been passed.

You will need to explicitly call {\bf resume()}{\rm (p.\,\pageref{classKProcess_a14})} after your call to {\bf start()}{\rm (p.\,\pageref{classKProcess_a8})} to begin processing data from the child process's 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 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 these signals, the respective communication link (stdout/stderr) has to be turned on in {\bf start}{\rm (p.\,\pageref{classKProcess_a8})}().

You should copy the information contained in {\tt buffer} to your private data structures before returning from this 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(), KProc\-IO::reset\-All(), and KProc\-IO::start().\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_a17})}() 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 \char`\"{}child\-Output\char`\"{} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em the}]file descriptor for the output \end{description}
\end{Desc}


Definition at line 535 of file kprocess.cpp.

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

Referenced by 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 \char`\"{}child\-Error\char`\"{} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em the}]file descriptor for the output \end{description}
\end{Desc}


Definition at line 542 of file kprocess.cpp.

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

Referenced by 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} \char`\"{}innot\char`\"{}. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dummy}]ignore this argument \end{description}
\end{Desc}


Definition at line 549 of file kprocess.cpp.

References innot, 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 set\-Environment(...). 



Definition at line 133 of file kprocess.cpp.

References QFile::encode\-Name().

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 \char`\"{}KProcess::start\char`\"{} right before a \char`\"{}fork\char`\"{} takes place. 

According to the \char`\"{}comm\char`\"{} parameter this function has to initialize the \char`\"{}in\char`\"{}, \char`\"{}out\char`\"{} and \char`\"{}err\char`\"{} data member of KProcess.

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

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

Definition at line 625 of file kprocess.cpp.

References KStd\-Action::close(), Communication, communication, 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 the reading end of the \char`\"{}stdin\char`\"{} communication channel.

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

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

Definition at line 664 of file kprocess.cpp.

References Block, KStd\-Action::close(), communication, QObject::connect(), innot, out, 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 \char`\"{}exec\char`\"{} on the child process' side. 

It usually just closes the unused communication ends of \char`\"{}in\char`\"{}, \char`\"{}out\char`\"{} and \char`\"{}err\char`\"{} (like the writing end of the \char`\"{}in\char`\"{} communication channel. 

Definition at line 712 of file kprocess.cpp.

References KStd\-Action::close(), communication, KStd\-Action::open(), 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 process has exited. 

This function normally calls comm\-Close to close all open communication channels to this process and emits the \char`\"{}process\-Exited\char`\"{} signal (if the process was not running in the \char`\"{}Dont\-Care\char`\"{} mode). 

Definition at line 567 of file kprocess.cpp.

References comm\-Close(), Dont\-Care, process\-Exited(), run\_\-mode, runs, and status.\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}


Should clean up the communication links to the child after it has exited. 

Should be called from \char`\"{}process\-Has\-Exited\char`\"{}. 

Definition at line 755 of file kprocess.cpp.

References child\-Error(), child\-Output(), KStd\-Action::close(), Communication, communication, innot, out, and runs.

Referenced by process\-Has\-Exited(), and start().\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_b6}


Called by \char`\"{}slot\-Child\-Output\char`\"{} this function copies data arriving from the child process's stdout to the respective buffer and emits the signal \char`\"{}@ref received\-Stderr\char`\"{}. 



Definition at line 586 of file kprocess.cpp.

References communication, and received\-Stdout().

Referenced by comm\-Close(), and 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_b7}


Called by \char`\"{}slot\-Child\-Output\char`\"{} this function copies data arriving from the child process's stdout to the respective buffer and emits the signal \char`\"{}@ref received\-Stderr\char`\"{}. 



Definition at line 611 of file kprocess.cpp.

References received\-Stderr().

Referenced by comm\-Close(), and 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 741 of file kprocess.h.

Referenced by KProcess().

\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 593 of file kprocess.h.

Referenced by args(), 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 598 of file kprocess.h.

Referenced by comm\-Setup\-Done\-P(), 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. For reading the value of this data member, please use \char`\"{}is\-Running()\char`\"{} since \char`\"{}runs\char`\"{} will probably be made private in later versions of KProcess. 

Definition at line 606 of file kprocess.h.

Referenced by comm\-Close(), detach(), is\-Running(), normal\-Exit(), process\-Has\-Exited(), set\-Executable(), start(), write\-Stdin(), and $\sim$KProcess().\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 (see \char`\"{}get\-Pid()\char`\"{}). 

You should not modify this data member in derived classes. Please use \char`\"{}get\-Pid()\char`\"{} instead of directly accessing this member function since it will probably be made private in later versions of KProcess. 

Definition at line 615 of file kprocess.h.

Referenced by detach(), kill(), normal\-Exit(), pid(), and start().\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 \char`\"{}waitpid\char`\"{}. 

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

Definition at line 624 of file kprocess.h.

Referenced by exit\-Status(), normal\-Exit(), process\-Has\-Exited(), and start().\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}


See {\bf set\-Run\-Privileged()}{\rm (p.\,\pageref{classKProcess_a22})}. 



Definition at line 630 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 stdin/stdout/stderr. 



Definition at line 700 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}!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 notifiers for the above socket descriptors. 



Definition at line 707 of file kprocess.h.

Referenced by close\-Stdin(), comm\-Close(), comm\-Setup\-Done\-P(), slot\-Send\-Data(), and write\-Stdin().\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 715 of file kprocess.h.

Referenced by child\-Output(), close\-Stderr(), close\-Stdin(), close\-Stdout(), comm\-Close(), comm\-Setup\-Done\-C(), comm\-Setup\-Done\-P(), resume(), setup\-Communication(), suspend(), and write\-Stdin().

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