summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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.