mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
added some shell comands
This commit is contained in:
parent
601e69604f
commit
6f9a4e7f83
1 changed files with 18 additions and 12 deletions
30
test/test.js
30
test/test.js
|
|
@ -1,18 +1,24 @@
|
|||
var util = require('util'),
|
||||
exec = require('child_process').exec,
|
||||
child;
|
||||
exec = require('child_process').exec;
|
||||
|
||||
|
||||
|
||||
exec('curl http://phantomjs.googlecode.com/files/phantomjs-1.5.0-linux-x86-dynamic.tar.gz',execFunctoin);
|
||||
exec('tar -zxf phantomjs-1.5.0-linux-x86-dynamic.tar.gz',execFunctoin);
|
||||
exec('./phantomjs/bin/phantomjs',execFunctoin);
|
||||
exec('curl http://phantomjs.googlecode.com/files/phantomjs-1.5.0-linux-x86-dynamic.tar.gz',makeExecFunctoin(_1));
|
||||
|
||||
function execFunctoin(error, stdout, stderr) {
|
||||
console.log('stdout: ' + stdout);
|
||||
console.log('stderr: ' + stderr);
|
||||
|
||||
if (error !== null) {
|
||||
console.log('exec error: ' + error);
|
||||
}
|
||||
var _1 = function(){exec('tar -zxf phantomjs-1.5.0-linux-x86-dynamic.tar.gz',makeExecFunctoin(_2));}
|
||||
var _2 = function(){exec('./phantomjs/bin/phantomjs',makeExecFunctoin(_3));};
|
||||
var _3 = function(){exec('ls',makeExecFunctoin());};
|
||||
|
||||
function makeExecFunctoin(pFunc){
|
||||
return function(error, stdout, stderr) {
|
||||
console.log('stdout: ' + stdout);
|
||||
console.log('stderr: ' + stderr);
|
||||
|
||||
if (error !== null) {
|
||||
console.log('exec error: ' + error);
|
||||
}
|
||||
else if(pFunc &&
|
||||
typeof pFunc==='function')
|
||||
pFunc();
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue