diff --git a/lib/plugins/http.coffee b/lib/plugins/http.coffee index 5ca2df7..f92c447 100644 --- a/lib/plugins/http.coffee +++ b/lib/plugins/http.coffee @@ -36,18 +36,20 @@ module.exports = (settings) -> else next new Error('Failed to find appropriate "server.js" or "app.js" file') args = args.join ' ' + console.log args http = exec args - done = false - interval = setInterval -> - clearInterval interval if done - , 100 + #done = false + #interval = setInterval -> + #console.log done + #clearInterval interval if done + #, 100 http.on 'exit', (code) -> if code is 0 then res.cyan settings.message_start else res.red 'Error while starting HTTP server' fs.unlinkSync pidfile if path.existsSync pidfile res.prompt() - done = true + #done = true if pipeStdout http.stdout.pipe( if typeof settings.stdout is 'string' @@ -63,6 +65,10 @@ module.exports = (settings) -> if detached pidfile = settings.pidfile or '/tmp/http.pid' fs.writeFileSync pidfile, '' + http.pid + setTimeout -> + res.cyan('HTTP server started').ln() if http + res.prompt() + , 500 shell.cmd 'http stop', 'Stop HTTP server', (req, res, next) -> if not shell.isShell or settings.detach pidfile = settings.pidfile or '/tmp/http.pid' diff --git a/lib/plugins/redis.coffee b/lib/plugins/redis.coffee index 207fc06..558e97d 100644 --- a/lib/plugins/redis.coffee +++ b/lib/plugins/redis.coffee @@ -30,7 +30,7 @@ module.exports = (settings) -> then fs.createWriteStream settings.stderr else settings.stderr ) - if not shell.isShell and settings.detach + if not shell.isShell or settings.detach pidfile = settings.pidfile or '/tmp/redis.pid' fs.writeFileSync pidfile, '' + redis.pid # Give a chance to redis to startup @@ -42,7 +42,7 @@ module.exports = (settings) -> if not shell.isShell or settings.detach pidfile = settings.pidfile or '/tmp/redis.pid' if not path.existsSync pidfile - return res.red('Failed to stop redis').prompt() + return res.red('Failed to stop redis: no pid file').prompt() pid = fs.readFileSync pidfile redis = spawn 'kill', [pid] redis.on 'exit', (code) ->