same for js_system

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16831 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Mathieu Rene 2010-02-25 21:28:29 +00:00
parent 474ca2a9bd
commit d66fb0f09c
1 changed files with 5 additions and 1 deletions

View File

@ -3525,10 +3525,14 @@ static JSBool js_bridge(JSContext * cx, JSObject * obj, uintN argc, jsval * argv
static JSBool js_system(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
char *cmd;
int saveDepth, result;
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
if (argc > 0 && (cmd = JS_GetStringBytes(JS_ValueToString(cx, argv[0])))) {
*rval = INT_TO_JSVAL(switch_system(cmd, SWITCH_TRUE));
saveDepth = JS_SuspendRequest(cx);
result = switch_system(cmd, SWITCH_TRUE);
JS_ResumeRequest(cx, saveDepth);
*rval = INT_TO_JSVAL(result);
return JS_TRUE;
}