i'm trying to use exec function in nodejs, but it's not working.
Here is the code that i'm runing :
import { exec } from "child_process";
exec("ssh ubuntu@myserverip", (error, stdout, stderr) => {
if (error) {
console.error(`error: ${error.message}`);
}
if (stderr) {
console.error(`stderr: ${stderr}`);
}
else {
console.log(`stdout:\n${stdout}`);
}
});
And that it what it returns :
While this is the output if I directly write on terminal :
Any idea about how can I fix it ?