diff options
-rw-r--r-- | project2/procRows.cpp | 12 | ||||
-rw-r--r-- | project2/procRows.h | 1 |
2 files changed, 12 insertions, 1 deletions
diff --git a/project2/procRows.cpp b/project2/procRows.cpp index f4d0f50..e5ed86a 100644 --- a/project2/procRows.cpp +++ b/project2/procRows.cpp @@ -25,7 +25,17 @@ _ProcRows::doOpen() const if (!f) { throw std::runtime_error("Could not open file"); } - return FileStarChannel(f, false, pclose); + return FileStarChannel(f, false, doClose); +} + +int +_ProcRows::doClose(FILE * f) +{ + int pclo = pclose(f); + if (pclo != 0) { + throw std::runtime_error("Subprocess returned an error"); + } + return 0; } #include "view.hpp" diff --git a/project2/procRows.h b/project2/procRows.h index 02add07..e28a5f5 100644 --- a/project2/procRows.h +++ b/project2/procRows.h @@ -10,6 +10,7 @@ class _ProcRows : public _FileRows { virtual void loadComplete(); virtual FileStarChannel doOpen() const; + static int doClose(FILE*); }; typedef _GenericView<_ProcRows> _ProcView; typedef _GenericIterate<_ProcRows> _ProcIterate; |