20 #ifndef __kprocess_h__
21 #define __kprocess_h__
23 #include <sys/types.h>
27 #include <tqvaluelist.h>
28 #include <tqcstring.h>
30 #include "tdelibs_export.h"
32 class TQSocketNotifier;
33 class TDEProcessPrivate;
159 Stdin = 1, Stdout = 2, Stderr = 4,
160 AllOutput = 6, All = 7,
194 TDEProcess( TQObject* parent,
const char *name = 0 );
222 bool setExecutable(
const TQString& proc) KDE_DEPRECATED;
248 TDEProcess &operator<<(
const TQCString & arg);
256 TDEProcess &operator<<(
const TQStringList& args);
262 void clearArguments();
290 virtual bool start(RunMode runmode = NotifyOnExit,
291 Communication comm = NoCommunication);
299 virtual bool kill(
int signo = SIGTERM);
305 bool isRunning()
const;
323 KDE_DEPRECATED pid_t
getPid()
const {
return pid(); }
343 bool wait(
int timeout = -1);
351 bool normalExit()
const;
361 bool signalled()
const;
372 bool coreDumped()
const;
380 int exitStatus()
const;
390 int exitSignal()
const;
422 bool writeStdin(
const char *buffer,
int buflen);
472 const TQValueList<TQCString> &
args() {
return arguments; }
483 void setRunPrivileged(
bool keepPrivileges);
490 bool runPrivileged()
const;
498 void setEnvironment(
const TQString &name,
const TQString &value);
506 void setWorkingDirectory(
const TQString &dir);
524 void setUseShell(
bool useShell,
const char *shell = 0);
535 static TQString quote(
const TQString &arg);
558 void setUsePty(Communication comm,
bool addUtmp);
573 enum { PrioLowest = 20, PrioLow = 10, PrioLower = 5, PrioNormal = 0,
574 PrioHigher = -5, PrioHigh = -10, PrioHighest = -19 };
582 bool setPriority(
int prio);
667 void slotChildOutput(
int fdno);
674 void slotChildError(
int fdno);
682 void slotSendData(
int dummy);
690 void setupEnvironment();
762 virtual int commSetupDoneP();
769 virtual int commSetupDoneC();
778 virtual void processHasExited(
int state);
805 virtual void commClose();
820 void setBinaryExecutable(
const char *filename);
859 int childOutput(
int fdno);
866 int childError(
int fdno);
888 virtual void virtual_hook(
int id,
void* data );
890 TDEProcessPrivate *d;
893 class KShellProcessPrivate;
925 static TQString
quote(
const TQString &arg);
931 virtual void virtual_hook(
int id,
void* data );
933 KShellProcessPrivate *d;
const char * input_data
The buffer holding the data that has to be sent to the child.
const TQValueList< TQCString > & args()
Lets you see what your arguments are for debugging.
bool keepPrivs
If false, the child process' effective uid & gid will be reset to the real values.
Communication
Modes in which the communication channel can be opened.
TQValueList< TQCString > arguments
The list of the process' command line arguments.
RunMode run_mode
How to run the process (Block, NotifyOnExit, DontCare).
void receivedStdout(int fd, int &len)
Emitted when output from the child process has been received on stdout.
@ NotifyOnExit
The application is notified when the subprocess dies.
Provides a high level representation of a pseudo tty pair, including utmp support.
KDE_DEPRECATED pid_t getPid() const
pid_t pid_
The PID of the currently running process.
bool runs
true if the process is currently running.
void processExited(TDEProcess *proc)
Emitted after the process has terminated when the process was run in the NotifyOnExit (==default opti...
@ Block
The application is suspended until the started process is finished.
int input_total
The total length of input_data.
void receivedStderr(TDEProcess *proc, char *buffer, int buflen)
Emitted, when output from the child process has been received on stderr.
A class derived from TDEProcess to start child processes through a shell.
virtual bool start(RunMode runmode=NotifyOnExit, Communication comm=NoCommunication)
Starts the process.
void receivedStdout(TDEProcess *proc, char *buffer, int buflen)
Emitted, when output from the child process has been received on stdout.
void wroteStdin(TDEProcess *proc)
Emitted after all the data that has been specified by a prior call to writeStdin() has actually been ...
Child process invocation, monitoring and control.
Communication communication
Lists the communication links that are activated for the child process.
Used internally by TDEProcess.
int input_sent
The number of bytes already transmitted.
static TQString quote(const TQString &arg)
This function can be used to quote an argument string such that the shell processes it properly.
int status
The process' exit status as returned by waitpid().
TQSocketNotifier * innot
The socket notifier for in[1].
TQSocketNotifier * outnot
The socket notifier for out[0].
@ DontCare
The application does not receive notifications from the subprocess when it is finished or aborted.
TQSocketNotifier * errnot
The socket notifier for err[0].
RunMode
Run-modes for a child process.