Exit nodejs with programResult (#6822)

This commit is contained in:
Alexander Ivanov 2017-11-28 03:30:49 +02:00 • committed by Andreas Rumpf
commit 95629acd4d

View file

@ -1439,7 +1439,11 @@ const
## is the value that should be passed to `quit <#quit>`_ to indicate ## is the value that should be passed to `quit <#quit>`_ to indicate
## failure. ## failure.
var programResult* {.exportc: "nim_program_result".}: int when defined(nodejs):
var programResult* {.importc: "process.exitCode".}: int
programResult = 0
else:
var programResult* {.exportc: "nim_program_result".}: int
## modify this variable to specify the exit code of the program ## modify this variable to specify the exit code of the program
## under normal circumstances. When the program is terminated ## under normal circumstances. When the program is terminated
## prematurely using ``quit``, this value is ignored. ## prematurely using ``quit``, this value is ignored.