X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/d63d2c3c6cbbd574dda4f8b00ebe6c661735edd5..2a1b3e92f806c2e2abb85d1cc6f71c187ca7d0c3:/lib/base/console.h diff --git a/lib/base/console.h b/lib/base/console.h index e69de29b..ddfd82a9 100644 --- a/lib/base/console.h +++ b/lib/base/console.h @@ -0,0 +1,48 @@ +#ifndef __LIB_BASE_CONSOLE_H__ +#define __LIB_BASE_CONSOLE_H__ + +#include +#include +#include +#include + +#ifndef SWIG +struct queue_data +{ + queue_data( char *data, int len ) + :data(data), len(len) + { + } + char *data; + int len; +}; +#endif + +class eConsoleAppContainer: public Object +{ +#ifndef SWIG + int fd[3]; + int pid; + int killstate; + std::queue outbuf; + eSocketNotifier *in, *out, *err; + void readyRead(int what); + void readyErrRead(int what); + void readyWrite(int what); + void closePipes(); +#endif +public: + eConsoleAppContainer(); + int execute( const std::string &str ); + ~eConsoleAppContainer(); + int getPID() { return pid; } + void kill(); + void sendCtrlC(); + void write( const char *data, int len ); + bool running() { return (fd[0]!=-1) && (fd[1]!=-1) && (fd[2]!=-1); } + PSignal1 dataAvail; + PSignal1 dataSent; + PSignal1 appClosed; +}; + +#endif // __LIB_BASE_CONSOLE_H__