diff --git a/modules/libcom/src/iocsh/iocsh.cpp b/modules/libcom/src/iocsh/iocsh.cpp index 0de90c87a..23e363ad4 100644 --- a/modules/libcom/src/iocsh/iocsh.cpp +++ b/modules/libcom/src/iocsh/iocsh.cpp @@ -11,6 +11,8 @@ /* Heavily modified by Eric Norum Date: 03MAY2000 */ /* Adapted to C++ by Eric Norum Date: 18DEC2000 */ +#include + #include #include #include @@ -834,7 +836,14 @@ iocshBody (const char *pathname, const char *commandLine, const char *macros) for (int iarg = 0 ; ; ) { if (iarg == piocshFuncDef->nargs) { startRedirect(filename, lineno, redirects); - (*found->def.func)(argBuf); + /* execute */ + try { + (*found->def.func)(argBuf); + } catch(std::exception& e){ + fprintf(epicsGetStderr(), "c++ error: %s\n", e.what()); + } catch(...) { + fprintf(epicsGetStderr(), "c++ error unknown\n"); + } break; } if (iarg >= argBufCapacity) {