pulumi/tools/mujs
joeduffy 3a5217d722 Fix truncated output...again
The prior workaround to avoid truncated pending stdout writes, it
turns out, doesn't actually work.  (Piping output leads to more buffering
and asynchrony, and turned up additional problems.)  Digging through some
GitHub issues led me to these "best practices":

    https://nodejs.org/api/process.html#process_process_exit_code

    The reason this is problematic is because writes to process.stdout in
    Node.js are sometimes non-blocking and may occur over multiple ticks of
    the Node.js event loop. Calling process.exit(), however, forces the
    process to exit before those additional writes to stdout can be performed.

    Rather than calling process.exit() directly, the code should set the
    process.exitCode and allow the process to exit naturally by avoiding
    scheduling any additional work for the event loop.

This change adopts this part of the best practices, by simply setting
exitCode upon normal termination and letting the event loop quiesce.

Note that I am still not obeying the other part of the guidance:

    If it is necessary to terminate the Node.js process due to an error
    condition, throwing an uncaught error and allowing the process to
    terminate accordingly is safer than calling process.exit().

Somewhat confusingly, writes to process.stderr do not suffer from these
same problems, because writes to stderr are synchronous.  We prefer to
tear down the process gracefully, without an unhandled exception, and
we are okay losing some stdout writes as a result, given that all error-
related ones will have gone to stderr.
2017-01-17 14:54:15 -08:00
..
cmd Fix truncated output...again 2017-01-17 14:54:15 -08:00
lib Add support for YAML project files to MuJS 2017-01-17 12:09:57 -08:00
tests Add support for YAML project files to MuJS 2017-01-17 12:09:57 -08:00
.gitignore Add a new harness for test cases 2017-01-08 15:20:46 -06:00
mujs Add a handy executable wrapper for MuJS 2017-01-08 15:34:10 -06:00
package.json Add support for YAML project files to MuJS 2017-01-17 12:09:57 -08:00
README.md Implement the MuIL AST 2016-12-30 15:34:49 -08:00
tsconfig.json Do a bit of house-cleaning 2017-01-13 10:42:50 -08:00
tslint.json Upgrade to latest TSLint, and compile cleanly 2016-12-31 11:16:36 -08:00
yarn.lock Add support for YAML project files to MuJS 2017-01-17 12:09:57 -08:00

MuJS

This directory contains Mu's JavaScript compiler.

It implements a subset of JavaScript with TypeScript-style type annotations, and can compile that subset into MuPack/IL.