You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
scripts模块使用了 node.js 中的 vm module 来执行脚本
内置提供了
app --- pomelo application 实例
os --- os 模块
fs --- fs 模块
process --- process 模块
util --- util 模块
来做为 vm 的 sandbox 上下文环境,即我们可以直接在脚本中调用这些
为了便于输出结果,在 adminConsole 中,把执行的结果统一赋值给了全局 result 变量
因此,在编写脚本的时候,要输出的结果要赋值给 result 变量(不要用 var 进行声明,它是全局的)
比如,可以编写一个脚本来获取服务器的cpu数量信息