Skip to content
Permalink
Browse files

perf(server): start the server via require instead of using node's sp…

…awn function
  • Loading branch information
jyounce committed Aug 28, 2015
1 parent b563e1c commit efc41ce8b732542c8b3ce6c39bf9b7d330084512
Showing with 6 additions and 9 deletions.
  1. +6 −9 tasks/server/spawn-server.coffee
@@ -1,15 +1,12 @@
module.exports = (gulp, config) ->
q = require 'q'
spawn = require('child_process').spawn
rbServerFile = config.dist.rb.server.scripts.path
path = require 'path'
rbServerFile = path.join config.app.dir, config.dist.rb.server.scripts.path

# register task
# =============
gulp.task "#{config.rb.prefix.task}spawn-server", ->
defer = q.defer()
server = spawn 'node', [ rbServerFile ]
server.stdout.on 'data', (data) ->
msg = data.toString().trim()
console.log msg.yellow
defer.resolve() if msg.indexOf(config.server.msg.start) isnt -1
defer.promise
defer = q.defer()
require rbServerFile
defer.resolve()
defer.promise

0 comments on commit efc41ce

Please sign in to comment.
You can’t perform that action at this time.