process.on("exit", ...)
http://nodejs.org/api/process.html#process_event_exit
On Wed, Feb 13, 2013 at 9:49 AM, António Ramos <[email protected]> wrote:
> How do i trap gracefull shutdown?
>
> Thank you?
>
>
> 2013/2/13 Floby <[email protected]>
>
>> My guess is that you have a graceful shutdown because there are no timers
>> left in the event loop.
>>
>> On Tuesday, 12 February 2013 23:44:43 UTC+1, Ramstein74 wrote:
>>>
>>> Hello my code exits after some time (10 minutes or just a minute) and no
>>> error in console.
>>>
>>> Can someone tell me why?
>>>
>>>
>>> xmlrpc = require("xmlrpc")
>>>
>>> args=process.argv.splice(2)
>>> comName = args[0]
>>> host=args[1]
>>> port=args[2]
>>> console.log("RFID at :"+comName+" Remote Server at:"+host+" port:"+port)
>>> SerialPort = require("serialport2").**SerialPort
>>> client = xmlrpc.createClient(
>>> host: host
>>> port: port
>>> path: "/EMPRE/default/call/xmlrpc"
>>> )
>>> sp = new SerialPort()
>>> sp.open comName,
>>> baudRate: 9600
>>> dataBits: 8
>>> parity: "none"
>>> stopBits: 1
>>> flowControl: false
>>> readData = ""
>>> sp.on "data", (data) ->
>>> readData += data.toString()
>>> if readData.length is 14
>>> console.log '\u001b[0m'
>>> console.log readData
>>> client.methodCall "RFID", [readData], (error, value) ->
>>> console.log "error no webservice",error,value
>>> readData = ""
>>>
>>> #PROCESS ERRORS!!!!
>>> sp.on 'error',(erro)->
>>> console.log "erro no serial",erro
>>>
>>> process.on "exit", (erro)->
>>> console.log "Sintaxe: coffee rfid.coffee COM[x] [IP] [port]",erro
>>> console.log '\u001b[0m'
>>>
>>> process.on 'SIGINT',->
>>> console.log 'detectado exit forçado pelo user..'
>>>
>>> process.on "uncaughtException" ,(erro)->
>>> console.log "erro inesperado",erro
>>> console.log "\u001b[36m"
>>> console.log new Date()
>>>
>>> process.on "error", ->
>>> console.log "error desconhecido"
>>>
>>> --
>> --
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines:
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "nodejs" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
> --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.