summaryrefslogtreecommitdiff
path: root/libopie/oprocess.h
Unidiff
Diffstat (limited to 'libopie/oprocess.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/oprocess.h72
1 files changed, 7 insertions, 65 deletions
diff --git a/libopie/oprocess.h b/libopie/oprocess.h
index fd726b4..bf5fe0e 100644
--- a/libopie/oprocess.h
+++ b/libopie/oprocess.h
@@ -174,33 +174,35 @@ public:
174 * The application does not receive notifications from the subprocess when 174 * The application does not receive notifications from the subprocess when
175 * it is finished or aborted. 175 * it is finished or aborted.
176 */ 176 */
177 DontCare, 177 DontCare,
178 /** 178 /**
179 * The application is notified when the subprocess dies. 179 * The application is notified when the subprocess dies.
180 */ 180 */
181 NotifyOnExit, 181 NotifyOnExit,
182 /** 182 /**
183 * The application is suspended until the started process is finished. 183 * The application is suspended until the started process is finished.
184 */ 184 */
185 Block }; 185 Block };
186 186
187 /** 187 /**
188 * Constructor 188 * Constructor
189 */ 189 */
190 OProcess(); 190 OProcess(QObject *parent = 0, const char *name = 0);
191 OProcess(const QString &arg0, QObject *parent = 0, const char *name = 0);
192 OProcess(const QStringList &args, QObject *parent = 0, const char *name = 0);
191 193
192 /** 194 /**
193 *Destructor: 195 *Destructor:
194 * 196 *
195 * If the process is running when the destructor for this class 197 * If the process is running when the destructor for this class
196 * is called, the child process is killed with a SIGKILL, but 198 * is called, the child process is killed with a SIGKILL, but
197 * only if the run mode is not of type @p DontCare. 199 * only if the run mode is not of type @p DontCare.
198 * Processes started as @p DontCare keep running anyway. 200 * Processes started as @p DontCare keep running anyway.
199 */ 201 */
200 virtual ~OProcess(); 202 virtual ~OProcess();
201 203
202 /** 204 /**
203 @deprecated 205 @deprecated
204 206
205 The use of this function is now deprecated. -- Please use the 207 The use of this function is now deprecated. -- Please use the
206 "operator<<" instead of "setExecutable". 208 "operator<<" instead of "setExecutable".
@@ -347,32 +349,34 @@ public:
347 * @ref writeStdin() is still in progress. 349 * @ref writeStdin() is still in progress.
348 * 350 *
349 * Please note that the data is sent to the client asynchronously, 351 * Please note that the data is sent to the client asynchronously,
350 * so when this function returns, the data might not have been 352 * so when this function returns, the data might not have been
351 * processed by the child process. 353 * processed by the child process.
352 * 354 *
353 * If all the data has been sent to the client, the signal 355 * If all the data has been sent to the client, the signal
354 * @ref wroteStdin() will be emitted. 356 * @ref wroteStdin() will be emitted.
355 * 357 *
356 * Please note that you must not free "buffer" or call @ref writeStdin() 358 * Please note that you must not free "buffer" or call @ref writeStdin()
357 * again until either a @ref wroteStdin() signal indicates that the 359 * again until either a @ref wroteStdin() signal indicates that the
358 * data has been sent or a @ref processHasExited() signal shows that 360 * data has been sent or a @ref processHasExited() signal shows that
359 * the child process is no longer alive... 361 * the child process is no longer alive...
360 **/ 362 **/
361 bool writeStdin(const char *buffer, int buflen); 363 bool writeStdin(const char *buffer, int buflen);
362 364
365 void flushStdin();
366
363 /** 367 /**
364 * This causes the stdin file descriptor of the child process to be 368 * This causes the stdin file descriptor of the child process to be
365 * closed indicating an "EOF" to the child. 369 * closed indicating an "EOF" to the child.
366 * 370 *
367 * @return @p false if no communication to the process's stdin 371 * @return @p false if no communication to the process's stdin
368 * had been specified in the call to @ref start(). 372 * had been specified in the call to @ref start().
369 */ 373 */
370 bool closeStdin(); 374 bool closeStdin();
371 375
372 /** 376 /**
373 * This causes the stdout file descriptor of the child process to be 377 * This causes the stdout file descriptor of the child process to be
374 * closed. 378 * closed.
375 * 379 *
376 * @return @p false if no communication to the process's stdout 380 * @return @p false if no communication to the process's stdout
377 * had been specified in the call to @ref start(). 381 * had been specified in the call to @ref start().
378 */ 382 */
@@ -718,88 +722,26 @@ private:
718 * not listed in /etc/shells will not used. 722 * not listed in /etc/shells will not used.
719 * 723 *
720 * @li If no valid shell could be found, "/bin/sh" is used as a last resort. 724 * @li If no valid shell could be found, "/bin/sh" is used as a last resort.
721 */ 725 */
722 QCString searchShell(); 726 QCString searchShell();
723 727
724 /** 728 /**
725 * Used by @ref searchShell in order to find out whether the shell found 729 * Used by @ref searchShell in order to find out whether the shell found
726 * is actually executable at all. 730 * is actually executable at all.
727 */ 731 */
728 bool isExecutable(const QCString &filename); 732 bool isExecutable(const QCString &filename);
729 733
730 // Disallow assignment and copy-construction 734 // Disallow assignment and copy-construction
731 OProcess( const OProcess& ); 735 OProcess( const OProcess& );
732 OProcess& operator= ( const OProcess& ); 736 OProcess& operator= ( const OProcess& );
733 737
734protected:
735 virtual void virtual_hook( int id, void* data );
736private:
737 OProcessPrivate *d;
738};
739
740class KShellProcessPrivate;
741
742/**
743* @obsolete
744*
745* This class is obsolete. Use OProcess and OProcess::setUseShell(true)
746* instead.
747*
748* @short A class derived from @ref OProcess to start child
749 * processes through a shell.
750* @author Christian Czezakte <e9025461@student.tuwien.ac.at>
751* @version $Id$
752*/
753class KShellProcess: public OProcess
754{
755 Q_OBJECT
756
757public:
758
759 /**
760 * Constructor
761 *
762 * By specifying the name of a shell (like "/bin/bash") you can override
763 * the mechanism for finding a valid shell as described in OProcess::searchShell()
764 */
765 KShellProcess(const char *shellname=0);
766
767 /**
768 * Destructor.
769 */
770 ~KShellProcess();
771
772 /**
773 * Starts up the process. -- For a detailed description
774 * have a look at the "start" member function and the detailed
775 * description of @ref OProcess .
776 */
777 virtual bool start(RunMode runmode = NotifyOnExit,
778 Communication comm = NoCommunication);
779
780 /**
781 * This function can be used to quote an argument string such that
782 * the shell processes it properly. This is e. g. necessary for
783 * user-provided file names which may contain spaces or quotes.
784 * It also prevents expansion of wild cards and environment variables.
785 */
786 static QString quote(const QString &arg);
787
788private: 738private:
739 void init ( );
789 740
790 QCString shell; 741 OProcessPrivate *d;
791
792 // Disallow assignment and copy-construction
793 KShellProcess( const KShellProcess& );
794 KShellProcess& operator= ( const KShellProcess& );
795
796protected:
797 virtual void virtual_hook( int id, void* data );
798private:
799 KShellProcessPrivate *d;
800}; 742};
801 743
802 744
803 745
804#endif 746#endif
805 747