00001 /* Copyright (c) 2006, Gennady Bystritsky <bystr@mac.com> 00002 * 00003 * Distributed under the MIT Licence. 00004 * This is free software. See 'LICENSE' for details. 00005 * You must read and accept the license prior to use. 00006 */ 00007 00008 #ifndef _SK_SYS_PTYPROCESS_ 00009 #define _SK_SYS_PTYPROCESS_ 00010 00011 #include <sk/util/Holder.hxx> 00012 #include <sk/sys/Process.h> 00013 #include <sk/sys/DelegatingExecutable.h> 00014 #include <sk/rt/Scope.h> 00015 00016 #include <sk/io/InputStream.h> 00017 #include <sk/io/OutputStream.h> 00018 #include <sk/io/Pty.h> 00019 00020 namespace sk { 00021 namespace sys { 00022 class PtyProcess 00023 : public virtual sk::sys::DelegatingExecutable 00024 { 00025 public: 00026 PtyProcess(const sk::util::StringArray& cmdline); 00027 virtual ~PtyProcess(); 00028 00029 sk::io::Pty& getPty(); 00030 00031 sk::io::InputStream& inputStream() const; 00032 sk::io::InputStream& inputErrorStream() const; 00033 sk::io::OutputStream& outputStream() const; 00034 00035 const sk::util::StringArray& errors() const; 00036 00037 // sk::util::Object re-implementation. 00038 const sk::util::Class getClass() const; 00039 00040 private: 00041 PtyProcess(const PtyProcess& other); 00042 PtyProcess& operator = (const PtyProcess& other); 00043 00044 // sk::sys::DelegatingExecutable implementation. 00045 sk::sys::Executable& getExecutable(); 00046 const sk::sys::Executable& getExecutable() const; 00047 00048 struct Listener; 00049 00050 const sk::rt::Scope _scope; 00051 sk::util::Holder<Listener> _listenerHolder; 00052 sk::sys::Process _process; 00053 }; 00054 } 00055 } 00056 00057 #endif /* _SK_SYS_PTYPROCESS_ */