Implement the exit() script function.

Refs #5846
This commit is contained in:
Gunnar Beutner 2014-03-23 17:26:36 +01:00
parent d23078d6c4
commit 09f1c46714
2 changed files with 8 additions and 0 deletions

View File

@ -25,6 +25,7 @@
#include "base/dictionary.h"
#include "base/serializer.h"
#include "base/logger_fwd.h"
#include "base/application.h"
#include <boost/regex.hpp>
#include <algorithm>
#include <set>
@ -37,6 +38,7 @@ REGISTER_SCRIPTFUNCTION(len, &ScriptUtils::Len);
REGISTER_SCRIPTFUNCTION(union, &ScriptUtils::Union);
REGISTER_SCRIPTFUNCTION(intersection, &ScriptUtils::Intersection);
REGISTER_SCRIPTFUNCTION(log, &ScriptUtils::Log);
REGISTER_SCRIPTFUNCTION(exit, &ScriptUtils::Exit);
bool ScriptUtils::Regex(const String& pattern, const String& text)
{
@ -109,3 +111,8 @@ void ScriptUtils::Log(const Value& message)
else
::Log(LogInformation, "config", JsonSerialize(message));
}
void ScriptUtils::Exit(int code)
{
exit(code);
}

View File

@ -38,6 +38,7 @@ public:
static Array::Ptr Union(const std::vector<Value>& arguments);
static Array::Ptr Intersection(const std::vector<Value>& arguments);
static void Log(const Value& message);
static void Exit(int code);
private:
ScriptUtils(void);