NewNodeJSRuntime 创建 Node.js 运行时
(config *RuntimeConfig)
| 351 | |
| 352 | // NewNodeJSRuntime 创建 Node.js 运行时 |
| 353 | func NewNodeJSRuntime(config *RuntimeConfig) *NodeJSRuntime { |
| 354 | if config == nil { |
| 355 | config = DefaultRuntimeConfig() |
| 356 | } |
| 357 | |
| 358 | nodePath := "node" |
| 359 | if path, err := exec.LookPath("node"); err == nil { |
| 360 | nodePath = path |
| 361 | } |
| 362 | |
| 363 | return &NodeJSRuntime{ |
| 364 | config: config, |
| 365 | nodePath: nodePath, |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | func (r *NodeJSRuntime) Language() Language { |
| 370 | return LangNodeJS |