Skip to content

Commit

Permalink
[netcore] Correctly send exit code to the caller
Browse files Browse the repository at this point in the history
Commit migrated from mono/mono@8da9eeb
  • Loading branch information
marek-safar committed Sep 26, 2019
1 parent 568122a commit 3014ac3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/mono/mono/mini/main-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "mini-runtime.h"
#include <mono/metadata/assembly.h>
#include <mono/metadata/assembly-internals.h>
#include <mono/metadata/environment.h>
#include <mono/metadata/loader-internals.h>
#include <mono/utils/mono-logger-internals.h>

Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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;
}

Expand Down

0 comments on commit 3014ac3

Please sign in to comment.