iocsh allow setting of error code

This commit is contained in:
Michael Davidsaver
2019-05-02 20:18:12 -07:00
parent 89c269e2d5
commit eba8a13a2c
2 changed files with 13 additions and 0 deletions

View File

@@ -511,6 +511,17 @@ typedef struct {
bool errored;
} Scope;
int iocshSetError(int err)
{
Scope *scope;
if (err && iocshScopeId) {
scope = (Scope *) epicsThreadPrivateGet(iocshScopeId);
if(scope) scope->errored = 1;
}
return err;
}
/*
* The body of the command interpreter
*/

View File

@@ -89,6 +89,8 @@ epicsShareFunc int epicsShareAPI iocshCmd(const char *cmd);
epicsShareFunc int epicsShareAPI iocshLoad(const char *pathname, const char* macros);
epicsShareFunc int epicsShareAPI iocshRun(const char *cmd, const char* macros);
epicsShareFunc int iocshSetError(int err);
/* Makes macros that shadow environment variables work correctly with epicsEnvSet */
epicsShareFunc void epicsShareAPI iocshEnvClear(const char *name);