'use strict' ; ( function ( ) { var nodeExec = require ( 'child_process' ) . exec , fs = require ( 'fs' ) , DOMAINNAME = 'IXDomains' ; function cmdExec ( cmdline , cwd , callback ) { var opts = { cwd : cwd } ; nodeExec ( cmdline , opts , function ( error , stdout , stderr ) { if ( callback ) { stderr = stderr || '' ; stdout = stdout || '' ; callback ( '' , [ error === null ? '' : ( '' + error . code ) , '' + stdout . split ( '\n' ) . length , stdout , stderr ] . join ( '\n' ) ) ; } } ) ; } function init ( DomainManager ) { var i , cmd , cmds = [ { name : 'exec' , f : cmdExec , desc : 'Executes as a child process' , params : [ { name : 'cmdline' , type : 'string' , description : 'node command' } , { name : 'cwd' , type : 'string' , description : 'path' } ] , returns : [ { name : 'out' , type : 'string' } ] } ] ; if ( ! DomainManager . hasDomain ( DOMAINNAME ) ) { DomainManager . registerDomain ( DOMAINNAME , { major : 0 , minor : 1 } ) ; } for ( i = 0 ; i < cmds . length ; i ++ ) { cmd = cmds [ i ] ; DomainManager . registerCommand ( DOMAINNAME , cmd . name , cmd . f , true , cmd . desc , cmd . params , cmd . returns || [ ] ) ; } } exports . init = init ; } ( ) ) ;