From 619269fff24049b1adc7e06f4f3dc89f2880a2cd Mon Sep 17 00:00:00 2001 From: Andreas Frisch Date: Sun, 19 Oct 2008 20:20:41 +0000 Subject: [PATCH] add command to manually close input pipe (send CTRL-D / EOF) --- lib/base/console.cpp | 11 +++++++++++ lib/base/console.h | 1 + 2 files changed, 12 insertions(+) diff --git a/lib/base/console.cpp b/lib/base/console.cpp index 6dc21d2e..3dfcbae8 100644 --- a/lib/base/console.cpp +++ b/lib/base/console.cpp @@ -268,6 +268,17 @@ void eConsoleAppContainer::sendCtrlC() } } +void eConsoleAppContainer::sendEOF() +{ + if (out) + out->stop(); + if (fd[1] != -1) + { + ::close(fd[1]); + fd[1]=-1; + } +} + void eConsoleAppContainer::closePipes() { if (in) diff --git a/lib/base/console.h b/lib/base/console.h index f7cd469c..e6c61766 100644 --- a/lib/base/console.h +++ b/lib/base/console.h @@ -45,6 +45,7 @@ public: int getPID() { return pid; } void kill(); void sendCtrlC(); + void sendEOF(); void write( const char *data, int len ); void write( PyObject *data ); void readFromFile( PyObject *py_filename ); -- 2.30.2