Fresco/Prague/include/Prague/IPC Agent.hh,1.16,1.17 Coprocess.hh,1.17,1.18 PipeAgent.hh,1.9,1.10 TTYAgent.hh,1.9,1.10 ptybuf.hh,1.8,1.9

Tobias Hunger <[email protected]> Thu, 06 Nov 2003 18:04:03 +0000
Newsgroups gmane.comp.video.fresco.cvs
Message-ID <[email protected]>
Update of /cvs/fresco/Fresco/Prague/include/Prague/IPC
In directory purcel:/tmp/cvs-serv25254/Prague/include/Prague/IPC

Modified Files:
	Agent.hh Coprocess.hh PipeAgent.hh TTYAgent.hh ptybuf.hh 
Log Message:
Throw std::runtime_error when something goes wrong creating a PTY/TTY.
This causes the TermDemo to fail gracefully instead of crashing,


Index: Agent.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Prague/include/Prague/IPC/Agent.hh,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- Agent.hh	31 Oct 2003 22:33:09 -0000	1.16
+++ Agent.hh	6 Nov 2003 18:03:59 -0000	1.17
@@ -22,6 +22,7 @@
 #ifndef _Prague_Agent_hh
 #define _Prague_Agent_hh
 
+#include <stdexcept>
 #include <Prague/IPC/ipcbuf.hh>
 
 namespace Prague
@@ -42,7 +43,7 @@
 
       //. bind the Agent to the Dispatcher, which increments the ref counter, and
       //. registers the i/o channels as specified with the iomask.
-      virtual void start();
+      virtual void start() throw(std::runtime_error);
       //. release the Agent from the Dispatcher, which decrements the ref counter.
       virtual void stop();
       bool running() const { return _running; }

Index: Coprocess.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Prague/include/Prague/IPC/Coprocess.hh,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- Coprocess.hh	3 Nov 2003 17:53:53 -0000	1.17
+++ Coprocess.hh	6 Nov 2003 18:03:59 -0000	1.18
@@ -53,7 +53,7 @@
       enum state_t {ready, running, exited, signaled};
       Coprocess(const std::string &, IONotifier *, EOFNotifier * = 0);
       virtual ~Coprocess();
-      virtual void start();
+      virtual void start() throw(std::runtime_error);
       virtual void stop();
       //. return the command of the process being run
       const std::string &command() const { return _path;}

Index: PipeAgent.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Prague/include/Prague/IPC/PipeAgent.hh,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- PipeAgent.hh	31 Oct 2003 22:33:09 -0000	1.9
+++ PipeAgent.hh	6 Nov 2003 18:03:59 -0000	1.10
@@ -34,7 +34,7 @@
       PipeAgent(const std::string &, IONotifier *, EOFNotifier * = 0);
       virtual ~PipeAgent();
       //. spawns a child process after creating a pipe, then redirects i/o to it
-      virtual void start();
+      virtual void start() throw(std::runtime_error);
     private:
       PipeAgent(const PipeAgent &);
       PipeAgent &operator = (const PipeAgent &);

Index: TTYAgent.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Prague/include/Prague/IPC/TTYAgent.hh,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- TTYAgent.hh	31 Oct 2003 22:33:09 -0000	1.9
+++ TTYAgent.hh	6 Nov 2003 18:03:59 -0000	1.10
@@ -34,7 +34,7 @@
       TTYAgent(const std::string &cmd, IONotifier *, EOFNotifier * = 0);
       virtual ~TTYAgent();
       //. spawns a child process after creating a tty/pty pair, then redirects i/o to it
-      virtual void  start();
+      virtual void  start() throw(std::runtime_error);
       //. since the tty preformats the coprocess' output, it needs to
       //. know the geometry for the text to fit in
       void set_window_size(unsigned short, unsigned short);

Index: ptybuf.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Prague/include/Prague/IPC/ptybuf.hh,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ptybuf.hh	31 Oct 2003 22:33:09 -0000	1.8
+++ ptybuf.hh	6 Nov 2003 18:03:59 -0000	1.9
@@ -24,6 +24,7 @@
 
 #include <Prague/IPC/ipcbuf.hh>
 #include <string>
+#include <stdexcept>
 
 namespace Prague
 {
@@ -33,15 +34,15 @@
     public:
       ptybuf();
       virtual ~ptybuf();
-      virtual std::streamsize sys_read(char *, std::streamsize);
-      const std::string &name() const { return ptydev;}
-      int openpty();
-      int opentty();
-      void setup();
-    protected:
-      std::string ptydev;
+      virtual std::streamsize sys_read(char *, std::streamsize)
+          throw(std::runtime_error);
+      const std::string &name() const { return my_ptydev; }
+      int openpty() throw(std::runtime_error);
+      int opentty() throw(std::runtime_error);
+      void setup() throw(std::runtime_error);
     private:
-      int tty;
+      std::string my_ptydev;
+      int my_tty;
   };
 
 } // namespace