Skip to content

Commit

Permalink
perf(server): start the server via require instead of using node's sp…
Browse files Browse the repository at this point in the history
…awn function
  • Loading branch information
jyounce committed Aug 28, 2015
1 parent b563e1c commit efc41ce
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions tasks/server/spawn-server.coffee
Original file line number Diff line number Diff line change
@@ -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.