Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXProcess.h
1 /********************************************************************************
2 * *
3 * P r o c e s s S u p p o r t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1997,2022 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXPROCESS_H
22 #define FXPROCESS_H
23 
24 namespace FX {
25 
26 class FXIODevice;
27 
28 
30 class FXAPI FXProcess {
31 private:
32  FXProcessID pid; // Handle to process
33  FXIODevice *input; // Input stream
34  FXIODevice *output; // Output stream
35  FXIODevice *errors; // Errors stream
36 private:
37  FXProcess(const FXProcess&);
38  FXProcess &operator=(const FXProcess&);
39 public:
40 
42  FXProcess();
43 
45  FXProcessID id() const;
46 
48  FXbool start(const FXchar* exec,const FXchar *const *args,const FXchar *const *env=nullptr);
49 
51  void setInputStream(FXIODevice* is){ input=is; }
52 
54  FXIODevice* getInputStream() const { return input; }
55 
57  void setOutputStream(FXIODevice* os){ output=os; }
58 
60  FXIODevice* getOutputStream() const { return output; }
61 
63  void setErrorStream(FXIODevice* es){ errors=es; }
64 
66  FXIODevice* getErrorStream() const { return errors; }
67 
69  static FXint current();
70 
72  static FXInputHandle handle();
73 
75  static void exit(FXint code=0);
76 
78  FXbool suspend();
79 
81  FXbool resume();
82 
84  FXbool kill();
85 
87  FXbool wait();
88 
90  FXbool wait(FXint& code);
91 
93  ~FXProcess();
94  };
95 
96 }
97 
98 #endif
FXIODevice * getInputStream() const
Return input stream.
Definition: FXProcess.h:54
Executable process.
Definition: FXProcess.h:30
void setOutputStream(FXIODevice *os)
Change output stream; handle must be Inheritable.
Definition: FXProcess.h:57
FXIODevice * getErrorStream() const
Return error stream.
Definition: FXProcess.h:66
FXIODevice * getOutputStream() const
Return output stream.
Definition: FXProcess.h:60
Definition: FX4Splitter.h:28
void setInputStream(FXIODevice *is)
Change input stream; handle must be Inheritable.
Definition: FXProcess.h:51
void setErrorStream(FXIODevice *es)
Change error stream; handle must be Inheritable.
Definition: FXProcess.h:63
FXIODevice manipulates a handle to operating system i/o device, such as pipes, sockets, or files.
Definition: FXIODevice.h:35

Copyright © 1997-2022 Jeroen van der Zijp