J'essaie d'exécuter un processus ssh enfant dans node.js et de le contrôler via mon programme. Mon code:Utilisation de SSH sur Node.js
var util = require('util');
var spawn = require('child_process').spawn;
var ssh = spawn('ssh', ['cloudstudios.ch']);
ssh.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
ssh.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
ssh.on('exit', function (code) {
console.log('child process exited with code ' + code);
});
Je peux entrer le mot de passe dans la console, mais je ne peux rien faire par la suite. Je reçois la ouput console suivante:
stderr: Pseudo-terminal will not be allocated because stdin is not a terminal.
[email protected]'s password:
stdout: Linux v 2.6.32-5-xen-amd64 #1 SMP Wed Jan 12 05:46:49 UTC 2011 x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
stderr: stdin: is not a tty
Quelqu'un at-il une idée comment je peux obtenir ce travail?
Merci!
Check this out https://github.com/steelbrain/node-ssh –