【发布时间】:2021-03-17 16:21:01
【问题描述】:
是否可以将变量传递给节点 cli 脚本的子进程? 例如:
const child = require('child_process').spawn;
const script = 'path/to/my/file.js';
const a = 'value';
// pass the variable a to child
child('node', [script], { cwd: __dirname });
【问题讨论】:
标签: node.js child-process