From 95629acd4d2db5bfb8a7feb902f2b66ee5b2fa73 Mon Sep 17 00:00:00 2001 From: Alexander Ivanov Date: Tue, 28 Nov 2017 03:30:49 +0200 Subject: Exit nodejs with programResult (#6822) --- lib/system.nim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/system.nim') 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. -- cgit 1.4.1-2-gfad0