Skip to content

Instantly share code, notes, and snippets.

@edwardhotchkiss
Created June 25, 2012 15:58
Show Gist options
  • Select an option

  • Save edwardhotchkiss/2989417 to your computer and use it in GitHub Desktop.

Select an option

Save edwardhotchkiss/2989417 to your computer and use it in GitHub Desktop.
restart = ->
child = exec('coffee server.coffee', (_error, _stdout, _stderr) ->
if _error
throw new Error(_error)
else
console.log '> server.coffee restarted successfully!'
)
# end
# end
###
@description catch uncaughtExceptions and restart
###
process.on 'uncaughtException', (error) ->
console.log error.toString(), true
console.log error.stack.toString(), true
console.log '> restarting server.coffee...'
restart()
# end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment