如何从 child_process 调用 execFile 方法来运行返回值列表的 bash 脚本?
我的 bash 文件 (test.sh) 返回一个包含 8 个值的列表,但下面的脚本只打印列表的最后一项。
const { execFile } = require('child_process');
const child = execFile('./test.sh', (error,stdout,stderror) => {
if (error) {
throw error;
}
console.log(stdout);
});