Report process exit code in console and to js.

Fixes #10.