libzypp  17.36.1
forkspawnengine_p.h
Go to the documentation of this file.
1 #ifndef ZYPPNG_IO_PRIVATE_FORKSPAWNENGINE_H
2 #define ZYPPNG_IO_PRIVATE_FORKSPAWNENGINE_H
3 
5 #include <glib.h>
6 
7 namespace zyppng {
8 
10  {
11  public:
12  ~AbstractDirectSpawnEngine() override;
13 
14  bool isRunning ( bool wait = false ) override;
15  bool waitForExit ( const std::optional<uint64_t> &timeout = {} ) override;
16 
17  protected:
18  void mapExtraFds( int controlFd = -1 );
19  void resetSignals();
20  };
21 
27  {
28  public:
29  bool start( const char *const *argv, int stdin_fd, int stdout_fd, int stderr_fd ) override;
30  bool usePty () const;
31  void setUsePty ( const bool set = true );
32 
33  private:
38  bool _use_pty = false;
39  };
40 
41 #if GLIB_CHECK_VERSION( 2, 58, 0)
42 
43 #define ZYPP_HAS_GLIBSPAWNENGINE 1
44 
50  class GlibSpawnEngine : public AbstractDirectSpawnEngine
51  {
52  public:
53  bool start( const char *const *argv, int stdin_fd, int stdout_fd, int stderr_fd ) override;
54 
55  private:
56  static void glibSpawnCallback ( void *data );
57  };
58 
59 #else
60  #define ZYPP_HAS_GLIBSPAWNENGINE 0
61 #endif
62 
63 }
64 
65 
66 #endif //
bool isRunning(bool wait=false) override
bool start(const char *const *argv, int stdin_fd, int stdout_fd, int stderr_fd) override
bool _use_pty
Set to true, if a pair of ttys is used for communication instead of a pair of pipes.
bool waitForExit(const std::optional< uint64_t > &timeout={}) override
void mapExtraFds(int controlFd=-1)
void setUsePty(const bool set=true)