formating
This commit is contained in:
parent
7c28ee7eb8
commit
c99f3e8877
35
lxc.js
35
lxc.js
@ -6,41 +6,6 @@ module.exports = function(config){
|
||||
// console.log('sysExec: ', command, '||| callback:', callback)
|
||||
cmd.get('unset XDG_SESSION_ID XDG_RUNTIME_DIR; cgm movepid all virt $$; '+command, callback)
|
||||
}
|
||||
/* var obj = {};
|
||||
var child = require('child'),
|
||||
sshBind = config.sshBind || false;
|
||||
|
||||
//http://stackoverflow.com/questions/10530532/
|
||||
function textToArgs(s){
|
||||
var words = [];
|
||||
s.replace(/"([^"]*)"|'([^']*)'|(\S+)/g,function(g0,g1,g2,g3){ words.push(g1 || g2 || g3 || '')});
|
||||
return words;
|
||||
}
|
||||
|
||||
var sysExec = function(command, onData, onClose){
|
||||
|
||||
onData = onData || function(){};
|
||||
onClose = onClose || function(){};
|
||||
|
||||
if (sshBind != false)
|
||||
{
|
||||
var runCommand = sshBind.slice();
|
||||
runCommand.push(command);
|
||||
} else {
|
||||
var runCommand = textToArgs('unset XDG_SESSION_ID XDG_RUNTIME_DIR; cgm movepid all virt $$; '+command);
|
||||
}
|
||||
|
||||
var errors = '';
|
||||
|
||||
child({
|
||||
command: runCommand.slice(0,1)[0],
|
||||
args: runCommand.slice(1),
|
||||
cbStdout: function(data){ onData(''+data) },
|
||||
cbStderr: function(data){ errors+=data; onData(''+data) },
|
||||
cbClose: function(exitCode){ onClose(exitCode == 0 ? null:exitCode, errors) }
|
||||
}).start();
|
||||
};
|
||||
*/
|
||||
|
||||
obj.create = function(name, template, config, cbComplete){
|
||||
sysExec('lxc-create -n '+name+' -t '+template, cbComplete);
|
||||
|
Loading…
x
Reference in New Issue
Block a user