summary refs log tree commit diff stats
path: root/lib/system.nim
diff options
context:
space:
mode:
authorAlexander Ivanov <alehander42@gmail.com>2017-11-28 03:30:49 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-11-28 02:30:49 +0100
commit95629acd4d2db5bfb8a7feb902f2b66ee5b2fa73 (patch)
tree086b895de53538ad7b427d234c6a3f69c15af637 /lib/system.nim
parent439b72b40248e35628d19a66cc658718bb94424e (diff)
downloadNim-95629acd4d2db5bfb8a7feb902f2b66ee5b2fa73.tar.gz
Exit nodejs with programResult (#6822)
Diffstat (limited to 'lib/system.nim')
-rw-r--r--lib/system.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/system.nim b/lib/system.nim
index d9e315da1..387973f4b 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -1439,7 +1439,11 @@ const
     ## is the value that should be passed to `quit <#quit>`_ to indicate
     ## 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
   ## under normal circumstances. When the program is terminated
   ## prematurely using ``quit``, this value is ignored.