From 3014ac31917442a620b634b98685babfadff17ad Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Thu, 26 Sep 2019 13:57:42 +0200 Subject: [PATCH] [netcore] Correctly send exit code to the caller Commit migrated from https://github.com/mono/mono/commit/8da9eebcc6cc2f0dbdb75f88ee48ecb682b68771 --- src/mono/mono/mini/main-core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mono/mono/mini/main-core.c b/src/mono/mono/mini/main-core.c index 181c7fd..16803d5 100644 --- a/src/mono/mono/mini/main-core.c +++ b/src/mono/mono/mini/main-core.c @@ -6,6 +6,7 @@ #include "mini-runtime.h" #include #include +#include #include #include @@ -281,6 +282,8 @@ int STDAPICALLTYPE coreclr_execute_assembly (void* hostHandle, unsigned int doma *ptr = NULL; mono_parse_env_options (&mono_argc, &mono_argv); + + // TODO: Should be return code of Main only (mono_jit_exec result) *exitCode = mono_main (mono_argc, mono_argv); return 0; @@ -292,6 +295,7 @@ int STDAPICALLTYPE coreclr_execute_assembly (void* hostHandle, unsigned int doma // Parameters: // hostHandle - Handle of the host // domainId - Id of the domain +// latchedExitCode - Latched exit code after domain unloaded // // Returns: // HRESULT indicating status of the operation. S_OK if the assembly was successfully executed @@ -307,6 +311,8 @@ int STDAPICALLTYPE coreclr_shutdown_2 (void* hostHandle, unsigned int domainId, trusted_platform_assemblies = NULL; mono_core_trusted_platform_assemblies_free (a); + *latchedExitCode = mono_environment_exitcode_get (); + return 0; } -- 2.7.4