nl_tokens: Usage : captain run [ -- watch ] [ -- fork ]
pl_tokens: function run ( ) { process . env [ 'NODE_PATH' ] = resolve ( PROJECT_ROOT , '..' ) ; helpers . countUsers ( function ( err , count ) { if ( err ) { throw err ; } if ( count > 0 ) { _run ( ) ; } else { terminal . abort ( 'You need to create at least one user with `captain create_user`' ) ; } } ) ; function _run ( ) { // TODO: Put this in settings var logs = join ( cwd , 'logs' ) , out = fs . openSync ( join ( logs , 'out.log' ) , 'a' ) , err = <mask> . openSync ( join ( logs , 'err.log' ) , 'a' ) ; if ( helpers . isCaptainProject ( ) ) { var bin = program . watch ? resolve ( PROJECT_ROOT , 'node_modules' , '.bin' , 'node-dev' ) : 'node' ; var options = program . fork ? { stdio : [ 'ignore' , out , err ] , detached : true } : { stdio : 'inherit' } ; var child = spawn ( bin , [ join ( cwd , 'index.js' ) ] , options ) ; var conf = require ( 'captain-core' ) . conf ; console . log ( terminal . cyan ( 'Your application is running at: ' ) + 'http://%s:%d' , conf . host , conf . port ) ; if ( program . fork ) { // TODO: Put this in settings fs . writeFileSync ( join ( cwd , 'node.pid' ) , String ( child . pid ) ) ; child . unref ( ) ; } } else { terminal . abort ( 'Not a Captain project' ) ; } } }