core/execute.js
function (exec_path, onExec) {

		var onFound = function () {
			
			// if file found, execute directly
			// store starting path
			args.exec_path = exec_path;
			
			LOG.warn('starting ' + size + ' [' + server_type + '] servers', l_name);
			
			// store an entry for the callback when all servers are started as requested
			// TODO: if it takes too long to start all app servers, then force return in some interval
			l_pendingStart.push({
				onDone: onDone,
				total: size,
				curr: 0,
				server_type: server_type,
				servers: []
			});
			
			start_server();
		}
		
		var file_path = SR.path.join(exec_path, args.name, 'frontier.js');
		LOG.warn('validate file_path: ' + file_path, l_name);
		
		// verify frontier file exists, if not then we try package.json
		SR.fs.stat(file_path, function (err, stats) {

			// file not found
			if (err) {
				file_path = SR.path.join(exec_path, 'package.json');
				
				// remove server name from parameter 
				args.name = '';
				
				SR.fs.stat(file_path, function (err, stats) {
					if (err) {
						return onExec('cannot find entry file');
					}
					onFound();
				});
			}
			onFound();
		});
	}
function (exec_path, onExec) {

		var onFound = function () {
			
			// if file found, execute directly
			// store starting path
			args.exec_path = exec_path;
			
			LOG.warn('starting ' + size + ' [' + server_type + '] servers', l_name);
			
			// store an entry for the callback when all servers are started as requested
			// TODO: if it takes too long to start all app servers, then force return in some interval
			l_pendingStart.push({
				onDone: onDone,
				total: size,
				curr: 0,
				server_type: server_type,
				servers: []
			});
			
			start_server();
		}
		
		var file_path = SR.path.join(exec_path, args.name, 'frontier.js');
		LOG.warn('validate file_path: ' + file_path, l_name);
		
		// verify frontier file exists, if not then we try package.json
		SR.fs.stat(file_path, function (err, stats) {

			// file not found
			if (err) {
				file_path = SR.path.join(exec_path, 'package.json');
				
				// remove server name from parameter 
				args.name = '';
				
				SR.fs.stat(file_path, function (err, stats) {
					if (err) {
						return onExec('cannot find entry file');
					}
					onFound();
				});
			}
			onFound();
		});
	}
function ( exec_path , onExec ) { var onFound = function ( ) { // if file found, execute directly // store starting path args . exec_path = exec_path ; LOG . warn ( 'starting ' + size + ' [' + server_type + '] servers' , l_name ) ; // store an entry for the callback when all servers are started as requested // TODO: if it takes too long to start all app servers, then force return in some interval l_pendingStart . push ( { onDone : onDone , total : size , curr : 0 , server_type : server_type , servers : [ ] } ) ; start_server ( ) ; } var file_path = SR . path . join ( exec_path , args . name , 'frontier.js' ) ; LOG . warn ( 'validate file_path: ' + file_path , l_name ) ; // verify frontier file exists, if not then we try package.json SR . fs . stat ( file_path , function ( err , stats ) { // file not found if ( err ) { file_path = SR . path . join ( exec_path , 'package.json' ) ; // remove server name from parameter  args . name = '' ; SR . fs . stat ( file_path , function ( err , stats ) { if ( err ) { return onExec ( 'cannot find entry file' ) ; } onFound ( ) ; } ) ; } onFound ( ) ; } ) ; }
try to execute on a given path
try to execute on a given path