Several improvements and unit test.

This version now does its own processing of lines, in a way that
guarantees that each line will be process by the full chain
of promises before the next line is read. The output is therefore
deterministic even when input is piped from a file.

One unit test is provided, which demonstrates that the input
script can return a promise, in which case the script interpreter
waits until the promise is fulfilled in order to print the result.
Tweaks to console logging of errors.
Merge pull request #2 from jimlloyd/feature/improved-with-unit-test

Several improvements and unit test.