Inspired by a blog post I experimented a bit with this approach. This gist goes into more details.
In general the approach seems to work fine, with the major caveat that a non-zero exit code is always reported as 1
instead of the real exit code.
The alternative of defining a new binary format with the binfmt_misc
module is way more elaborate, but Ubuntu Trusty does not support the binfmt_misc
module out of the box (Xenial has it).
You'll need Vagrant and Ruby installed; then:
vagrant up
./test