Skip to content

Module.callMain and Module.run should always return exit code (regardless of MODULARIZE or EXIT_RUNTIME settings) #12219

Description

@vadimkantorov

Original title: Retrieve exit status in with -s MODULARIZE=1 and -s EXIT_RUNTIME=0
I build my xetex executable as:

emcc -g -O2 -s MODULARIZE=1 -s EXPORT_NAME=busytex --pre-js $ROOT/texlive.js -s TOTAL_MEMORY=$TOTAL_MEMORY -s ERROR_ON_UNDEFINED_SYMBOLS=0  -s FORCE_FILESYSTEM=1 -s LZ4=1 -s INVOKE_RUN=0 -s EXPORTED_FUNCTIONS='["_main"]' -s EXPORTED_RUNTIME_METHODS='["callMain","FS", "ENV"]' -o $ROOT/busytex.js  $XETEX_OBJECTS $XETEX_DEPS $DVIPDF_DEPS $DVIPDF_OBJECTS $ROOT/busytex.c

And then I call callMain twice:

Module.callMain(['xetex', '--interaction=nonstopmode', '--halt-on-error', '--no-pdf', '--fmt=' + fmt_xelatex,  source_name]);
Module.callMain(['dvipdfmx', source_name.replace('.tex', '.xdv')]);

Each of these runs calls exit(...) internally

How can I retrieve exit status of both runs?

I don't see any error message as in

var msg = 'program exited (with status: ' + status + '), but EXIT_RUNTIME is not set, so halting execution but not exiting the runtime or preventing further async execution (build with EXIT_RUNTIME=1, if you want a true shutdown)';
and Module.EXITSTATUS does not exist. onExit / exit / quit_ Module methods aren't somehow being run.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions