ucode: parse ucode plugin scripts in raw mode, init search path
It makes little sense to execute rpcd ucode plugin scripts in template mode since those scripts are supposed to output structured JSON data, so change the parse config to compile scripts in raw mode. Also initialize the default library search path which is required in recent ucode versions. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
1c4825739b
commit
ae5afea283
2 changed files with 3 additions and 3 deletions
|
@ -1,5 +1,3 @@
|
||||||
{%
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
let ubus = require('ubus').connect();
|
let ubus = require('ubus').connect();
|
||||||
|
|
4
ucode.c
4
ucode.c
|
@ -77,7 +77,8 @@ typedef struct {
|
||||||
static uc_parse_config_t config = {
|
static uc_parse_config_t config = {
|
||||||
.strict_declarations = false,
|
.strict_declarations = false,
|
||||||
.lstrip_blocks = true,
|
.lstrip_blocks = true,
|
||||||
.trim_blocks = true
|
.trim_blocks = true,
|
||||||
|
.raw_mode = true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -928,6 +929,7 @@ rpc_ucode_script_execute(struct ubus_context *ctx, const char *path, uc_program_
|
||||||
|
|
||||||
script->path = strncpy(pptr, path, pathlen);
|
script->path = strncpy(pptr, path, pathlen);
|
||||||
|
|
||||||
|
uc_search_path_init(&config.module_search_path);
|
||||||
uc_vm_init(&script->vm, &config);
|
uc_vm_init(&script->vm, &config);
|
||||||
rpc_ucode_init_globals(script);
|
rpc_ucode_init_globals(script);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue