ui.cli: Add do_shell() and associated framework
For more open ended questions, users may need an interactive shell to
develop the answer, and we won't be able to bundle their answer with
setup and teardown instructions in a single script. This commit
breaks setup and teardown into separate scripts, and moves the
TemporaryDirectory stuff over to quizzer.util. If it's enabled via
allow_interactive, users can now drop into an interactive command
using !$COMMAND (e.g. !bash) from the cli user interface.
If you want to tweak environment variables for the answer script and
interactive commands, use the new environment dictionary.
For situations where you *do* need setup/teardown stuff in the answer
script (e.g. to check the current working directory or variables that
should have been altered by the user's answer action), you can use
the new pre_answer and post_answer.
Previous versions of ScriptQuestion compared the output of the single
setup/answer/teardown script to check for matches. With this commit
we only compare the output of the teardown script, unless
compare_answers is set, in which case we compare both the answer
output and teardown output. When we're not comparing the answer
output, we still plot nonempty user-answer standard errors, because
without seeing stderr, it can be difficult to determine where your
attempted command went wrong.
Existing quizzes were updated accordingly, with a few additional
tweaks and cleanups that I discovered while debugging.