我运行了一个使用node-jq的脚本。我不得不将jq的打包二进制文件降级到v1.5,因为我得到了GLIBC_2.23 not found
在lambci的docker映像上,它工作正常。
我尝试在AWS Lambda上运行它,但它抛出childProcess.spawn
部分,但没有输出:
https://github.com/sanack/node-jq/blob/master/src/exec.js#L27
import childProcess from 'child_process'
import stripEof from 'strip-eof'
const TEN_MEBIBYTE = 1024 * 1024 * 10
const exec = (command, args) => {
return new Promise((resolve, reject) => {
var stdout = ''
var stderr = ''
const process = childProcess.spawn(
command,
args,
{ maxBuffer: TEN_MEBIBYTE }
)
process.stdout.on('data', (data) => {
stdout += data
})
process.stderr.on('data', (data) => {
stderr += data
})
process.on('close', (code) => {
if (code !== 0) {
return reject(Error(stderr))
} else {
return resolve(stripEof(stdout))
}
})
})
}
export default exec
我添加了这一行:
process.on('exit', (code, signal) => {
console.log('exit');
resolve({ code, signal, stdout, stderr });
});
并收到了此消息:
2019-03-13T01:17:48.810Z 350a83b3-2f1f-437d-91dc-4dfcdb1b362f { code: null, signal: 'SIGSEGV', stdout: '', stderr: '' }
从源头上遵守jq对您有帮助吗? https://github.com/stedolan/jq/issues/1598