Javascript sshpass不是';在NodeJS子进程(exec)中工作
我正在尝试从docker容器(ubuntu18.04)访问主机 因此,我使用子进程(exec)在脚本中运行CMDJavascript sshpass不是';在NodeJS子进程(exec)中工作,javascript,node.js,docker,ubuntu,child-process,Javascript,Node.js,Docker,Ubuntu,Child Process,我正在尝试从docker容器(ubuntu18.04)访问主机 因此,我使用子进程(exec)在脚本中运行CMD exec(sshpass -p <password> ssh -tt -o StrictHostKeyChecking=no <hostname>@<server>, (error, stdout, stderr) => { if (error) { console.log(`error: ${error.message}`)
exec(sshpass -p <password> ssh -tt -o StrictHostKeyChecking=no <hostname>@<server>, (error, stdout, stderr) => {
if (error) {
console.log(`error: ${error.message}`);
return;
}
if (stderr) {
console.log(`stderr: ${stderr}`);
return;
}
console.log(`stdout: ${stdout}`);
});
exec(sshpass-psh-tt-ostricthostkeychecking=no@,(错误,stdout,stderr)=>{
如果(错误){
log(`error:${error.message}`);
返回;
}
如果(标准){
log(`stderr:${stderr}`);
返回;
}
log(`stdout:${stdout}`);
});
它不适用于子进程
但该命令在集装箱码头内工作
sshpass-psh-tt-o StrictHostKeyChecking=no@
我的代码有什么问题吗