Transparent command execution library & command execution tool.
- node >= 0.10.x
$ npm install anyrun
// local
anyrun()
.run('uname -s', function (err, stdout, stderr) {
if (err) {
console.error('uname error: code = %d, signal = %s', err.code, err.signal);
return;
}
console.log('uname done: ', stdout);
})
.run('echo "Hello world"', function (err, stdout, stderr) {
console.log('echo done');
});
// remote
anyrun()
.ssh('host', 'example.com')
.ssh('port', 2222)
.run('uname -u', function (err, stdout, stderr) {
console.log('uname done');
})
.run('echo "Hello world"', function (err, stdout, stderr) {
console.log('echo done');
})
Initialize a new AnyRun
instance.
Initialize a new AnyRun
instance.
Set ssh options.
key
: the option keyvalue
: the option value
Run command.
cmd
: the commandopts
: the optionscb
: thecb(err, stdout, stderr)
callback
Done ssh session.
cb
: thecb(err)
callback
You must be prepared following before running the test.
- setup Virtualbox
- setup Vagrant
- start Vagrant VM
- setting sshd config (add
__HOGE__
toAcceptEnv
) on server, and restart - copy the private key genereted by Vagrant to
test/fixtures/id_rsa.vagrant
When you're ready, run the following command:
$ make test
See the LICENSE
.